BUG #14862: create table with missing sequence bug

Started by Gezeala M. Bacuño IIover 8 years ago3 messagesbugs
Jump to latest
#1Gezeala M. Bacuño II
gezeala@gmail.com

The following bug has been logged on the website:

Bug reference: 14862
Logged by: pgyayix
Email address: gezeala@gmail.com
PostgreSQL version: 9.4.9
Operating system: CentOS 7
Description:

--on a fresh db:
CREATE SCHEMA testschema;

--sequence is missing
--create table fails:
CREATE TABLE testschema.sometable1 (
col1 bigint DEFAULT
nextval('missingschema.missingsequence_id1'::regclass) NOT NULL,
col2 text
);

--sequence is missing
--create table works fine:
CREATE TABLE testschema.sometable2 (
col1 bigint DEFAULT
nextval(('missingschema.missingsequence_id2'::text)::regclass) NOT NULL,
col2 text
);

Only difference is sometable2 sequence definition has ::text::regclass.

Thanks.

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Gezeala M. Bacuño II (#1)
Re: BUG #14862: create table with missing sequence bug

gezeala@gmail.com writes:

--on a fresh db:
CREATE SCHEMA testschema;

--sequence is missing
--create table fails:
CREATE TABLE testschema.sometable1 (
col1 bigint DEFAULT
nextval('missingschema.missingsequence_id1'::regclass) NOT NULL,
col2 text
);

--sequence is missing
--create table works fine:
CREATE TABLE testschema.sometable2 (
col1 bigint DEFAULT
nextval(('missingschema.missingsequence_id2'::text)::regclass) NOT NULL,
col2 text
);

Only difference is sometable2 sequence definition has ::text::regclass.

This looks like the expected and documented behavior to me. See the
"Note" regarding early vs. late binding of sequence names at

https://www.postgresql.org/docs/current/static/functions-sequence.html

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

#3Gezeala M. Bacuño II
gezeala@gmail.com
In reply to: Tom Lane (#2)
Re: BUG #14862: create table with missing sequence bug

On Thu, Oct 19, 2017 at 10:46 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

gezeala@gmail.com writes:

--on a fresh db:
CREATE SCHEMA testschema;

--sequence is missing
--create table fails:
CREATE TABLE testschema.sometable1 (
col1 bigint DEFAULT
nextval('missingschema.missingsequence_id1'::regclass) NOT NULL,
col2 text
);

--sequence is missing
--create table works fine:
CREATE TABLE testschema.sometable2 (
col1 bigint DEFAULT
nextval(('missingschema.missingsequence_id2'::text)::regclass) NOT NULL,
col2 text
);

Only difference is sometable2 sequence definition has ::text::regclass.

This looks like the expected and documented behavior to me. See the
"Note" regarding early vs. late binding of sequence names at

https://www.postgresql.org/docs/current/static/functions-sequence.html

regards, tom lane

Thanks for looking into it.

--

regards

gezeala bacuño II

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