pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #12259: Bug in restore Serial definition
2+ messages / 2 participants
[nested] [flat]

* BUG #12259: Bug in restore Serial definition
@ 2014-12-17 12:51  fcs1@poczta.onet.pl
  0 siblings, 1 reply; 2+ messages in thread

From: fcs1@poczta.onet.pl @ 2014-12-17 12:51 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      12259
Logged by:          Michal
Email address:      fcs1@poczta.onet.pl
PostgreSQL version: 9.1.14
Operating system:   Windows 7 x64 Ultimate
Description:        

Hello,

I have two schemas: public and blob01.
In blob01 schema I have only one table "blob" with primary index ID defined
as
nextval('blob01.osr_blob_id_seq'::regclass)

After restoring by PG_restore the definition is changed to 
nextval('osr_blob_id_seq'::regclass), the schema definition is dropped.
Due to this the sequence is not accessible because it is in blob01 schema,
not in public schema.

How to restore blob01 saving schema for definition the ID field ?

Regards
Michal


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #12259: Bug in restore Serial definition
@ 2014-12-17 17:46  Tom Lane <tgl@sss.pgh.pa.us>
  parent: fcs1@poczta.onet.pl
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2014-12-17 17:46 UTC (permalink / raw)
  To: fcs1@poczta.onet.pl; +Cc: pgsql-bugs

fcs1@poczta.onet.pl writes:
> I have two schemas: public and blob01.
> In blob01 schema I have only one table "blob" with primary index ID defined
> as
> nextval('blob01.osr_blob_id_seq'::regclass)

> After restoring by PG_restore the definition is changed to 
> nextval('osr_blob_id_seq'::regclass), the schema definition is dropped.
> Due to this the sequence is not accessible because it is in blob01 schema,
> not in public schema.

This report doesn't prove there's anything wrong.  A regclass constant is
not ordinarily displayed with a schema unless the target object wouldn't
be found in the current search path.  For example:


regression=# create schema blob01;
CREATE SCHEMA
regression=# create sequence blob01.osr_blob_id_seq;
CREATE SEQUENCE
regression=# create table blob01.blob(f1 int default nextval('blob01.osr_blob_id_seq'));
CREATE TABLE
regression=# \d blob01.blob
                          Table "blob01.blob"
 Column |  Type   |                      Modifiers                      
--------+---------+-----------------------------------------------------
 f1     | integer | default nextval('blob01.osr_blob_id_seq'::regclass)

regression=# set search_path = blob01;
SET
regression=# \d blob01.blob
                       Table "blob01.blob"
 Column |  Type   |                  Modifiers                   
--------+---------+----------------------------------------------
 f1     | integer | default nextval('osr_blob_id_seq'::regclass)


When I pg_dump this, I get output like


SET search_path = blob01, pg_catalog;

--
-- Name: osr_blob_id_seq; Type: SEQUENCE; Schema: blob01; Owner: postgres
--

CREATE SEQUENCE osr_blob_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;

ALTER TABLE osr_blob_id_seq OWNER TO postgres;

--
-- Name: blob; Type: TABLE; Schema: blob01; Owner: postgres; Tablespace: 
--

CREATE TABLE blob (
    f1 integer DEFAULT nextval('osr_blob_id_seq'::regclass)
);

ALTER TABLE blob OWNER TO postgres;


which will work just fine because of the search_path setting.

There may indeed be some bug in this vicinity, but you'll need to provide
a complete self-contained test case to prove it.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-12-17 17:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-12-17 12:51 BUG #12259: Bug in restore Serial definition fcs1@poczta.onet.pl
2014-12-17 17:46 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox