Unix Technical Forum

BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification

This is a discussion on BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification within the pgsql Bugs forums, part of the PostgreSQL category; --> The following bug has been logged online: Bug reference: 3224 Logged by: Gabriele Bartolini Email address: g.bartolini@comune.prato.it PostgreSQL version: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Bugs

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 10:42 AM
Gabriele Bartolini
 
Posts: n/a
Default BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification


The following bug has been logged online:

Bug reference: 3224
Logged by: Gabriele Bartolini
Email address: g.bartolini@comune.prato.it
PostgreSQL version: 8.2.3
Operating system: GNU/Linux ( 2.6.9-42.0.2.ELsmp )
Description: Dump: missing schema name for sequence in a "DEFAULT
nextval" specification
Details:

Here is the example. I have a schema called 'dimensions' where I have a
hosts_2006_seq sequence and a hosts_2006 table, defined as follows:

CREATE SCHEMA dimensions;
CREATE SEQUENCE dimensions.hosts_2006_seq;
CREATE TABLE dimensions.hosts_2006
(
id_host integer NOT NULL DEFAULT
nextval('dimensions.hosts_2006_seq'::regclass),
host character varying(255) NOT NULL DEFAULT ''::character varying,
CONSTRAINT hosts_2006_pkey PRIMARY KEY (id_host)
);

As you can see I want the 'nextval' function to get the sequence value from
the proper table in the 'dimensions' schema, and that works fine.

However, when I issue a pg_dump or pg_dumpall command, here is what I get:

SET search_path = dimensions, pg_catalog;
CREATE SEQUENCE hosts_2006_seq;
CREATE TABLE hosts_2006 (
id_host integer DEFAULT nextval('hosts_2006_seq'::regclass) NOT NULL,
host character varying(255) DEFAULT ''::character varying NOT NULL,
);

This causes the 'nextval()' to go and look for the proper sequence according
to the search path and not in an absolute way.

I don't know whether this can be considered a bug, but it definitely created
a few problems on my scenario.

Thank you.

Ciao,
Gabriele

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 10:42 AM
Tom Lane
 
Posts: n/a
Default Re: BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification

"Gabriele Bartolini" <g.bartolini@comune.prato.it> writes:
> However, when I issue a pg_dump or pg_dumpall command, here is what I get:


> SET search_path = dimensions, pg_catalog;
> CREATE SEQUENCE hosts_2006_seq;
> CREATE TABLE hosts_2006 (
> id_host integer DEFAULT nextval('hosts_2006_seq'::regclass) NOT NULL,
> host character varying(255) DEFAULT ''::character varying NOT NULL,
> );


This is not a bug: the regclass constant will be recreated the same as
it was before.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 10:43 AM
Gabriele Bartolini
 
Posts: n/a
Default R: BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification

Hi Tom,

thanks for the answer. However, I still cannot understand why the 'dimensions' schema has disappeared from the dump of the sequence. I will do further investigation and let you know.

Ciao,
Gabriele

P.S.: Would you think of coming to the Italian PostgreSQL Day in July? I am one of the main organisers of the event.

-----Messaggio originale-----
Da: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Inviato: ven 13/04/2007 17.15
A: Gabriele Bartolini
Cc: pgsql-bugs@postgresql.org
Oggetto: Re: [BUGS] BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification

"Gabriele Bartolini" <g.bartolini@comune.prato.it> writes:
> However, when I issue a pg_dump or pg_dumpall command, here is what I get:


> SET search_path = dimensions, pg_catalog;
> CREATE SEQUENCE hosts_2006_seq;
> CREATE TABLE hosts_2006 (
> id_host integer DEFAULT nextval('hosts_2006_seq'::regclass) NOT NULL,
> host character varying(255) DEFAULT ''::character varying NOT NULL,
> );


This is not a bug: the regclass constant will be recreated the same as
it was before.

regards, tom lane


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 10:43 AM
Alvaro Herrera
 
Posts: n/a
Default Re: R: BUG #3224: Dump: missing schema name for sequence in a "DEFAULT nextval" specification

Gabriele Bartolini wrote:
> Hi Tom,
>
> thanks for the answer. However, I still cannot understand why the
> 'dimensions' schema has disappeared from the dump of the sequence.
> I will do further investigation and let you know.


It disappeared because it's not necessary. The search_path setting just
above makes sure that it is restored correctly.


--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:45 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com