Skip site navigation (1) Skip section navigation (2)

Strange behavior regarding temporary sequences

From: Harald Fuchs <nospam(at)sap(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Strange behavior regarding temporary sequences
Date: 2003-10-02 12:19:08
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Consider the following:

$ psql test
test=# create temp sequence ts;
test=# create table tt1 (id int not null default nextval ('ts'), str varchar(255) not null);
test=# insert into tt1 (str) values ('str1');                                   
INSERT 45510657 1
test=# select * from tt1;
 id | str  
  1 | str1
(1 row)

test=# \q
$ pg_dump -s -t tt1 test
-- PostgreSQL database dump

\connect - hf

SET search_path = public, pg_catalog;

-- TOC entry 2 (OID 45510654)
-- Name: tt1; Type: TABLE; Schema: public; Owner: hf

    id integer DEFAULT nextval('ts'::text) NOT NULL,
    str character varying(255) NOT NULL
$ psql test
test=# insert into tt1 (str) values ('str2');
ERROR:  Relation "ts" does not exist
test=# \q

Although what PostgreSQL (7.3.4) does is perfectly reasonable, I find
it somewhat unclean.  Since we now disallow FOREIGN KEYs between temp
and normal tables, we might also disallow using temp sequences with
normal tables.



pgsql-hackers by date

Next:From: Rod TaylorDate: 2003-10-02 12:28:08
Subject: Re: Thoughts on maintaining 7.3
Previous:From: Oliver ElphickDate: 2003-10-02 09:33:05
Subject: Re: minor view creation weirdness

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group