pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
nextval problem
2+ messages / 2 participants
[nested] [flat]

* nextval problem
@ 2004-02-13 01:54 Ivo Anon <ivoa72@hotmail.com>
  2004-02-16 17:51 ` Re: nextval problem Greg Patnude <gpatnude@hotmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ivo Anon @ 2004-02-13 01:54 UTC (permalink / raw)
  To: " <pgsql-novice@postgresql.org.pgsql-sql>

I'm new to postgresql and I'm having problems with the 'nextval' function
(or whatever it is called in postgresql).

I created a table (called ADDRESS) using 'pgadmin' which has a serial field
(called addressid). When I tried the sql statement:

        select nextval('public."ADDRESS_addressid_seq"')

everything seemed to be working fine.

I then used the create table statement (displayed in pgadmin when the table
'ADDRESS' is selected) to create the same table (of course after first
dropping 'ADDRESS'). When I try the same select-statement I suddenly got an
error message saying:

        ERROR:  Relation "public"."ADDRESS_addressid_seq" does not exist

Can anybody help me with this problem?





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

* Re: nextval problem
  2004-02-13 01:54 nextval problem Ivo Anon <ivoa72@hotmail.com>
@ 2004-02-16 17:51 ` Greg Patnude <gpatnude@hotmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Greg Patnude @ 2004-02-16 17:51 UTC (permalink / raw)
  To: pgsql-sql

New feature for posgreSQL 7.3 & later -- sequences are automatically dropped
when the owning table is dropped -- you need to recreate the sequence....

The easiest way is in your CREATE TABLE tblName (

    id serial PRIMARY KEY,
    blah...,
    blah...,

) WITH OIDS;

-- 
Greg Patnude / The Digital Demention
2916 East Upper Hayden Lake Road
Hayden Lake, ID 83835
(208) 762-0762

"Ivo Anon" <ivoa72@hotmail.com> wrote in message
news:h7WWb.13725$2Z2.1853@amsnews05.chello.com...
> I'm new to postgresql and I'm having problems with the 'nextval' function
> (or whatever it is called in postgresql).
>
> I created a table (called ADDRESS) using 'pgadmin' which has a serial
field
> (called addressid). When I tried the sql statement:
>
>         select nextval('public."ADDRESS_addressid_seq"')
>
> everything seemed to be working fine.
>
> I then used the create table statement (displayed in pgadmin when the
table
> 'ADDRESS' is selected) to create the same table (of course after first
> dropping 'ADDRESS'). When I try the same select-statement I suddenly got
an
> error message saying:
>
>         ERROR:  Relation "public"."ADDRESS_addressid_seq" does not exist
>
> Can anybody help me with this problem?
>
>






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


end of thread, other threads:[~2004-02-16 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-02-13 01:54 nextval problem Ivo Anon <ivoa72@hotmail.com>
2004-02-16 17:51 ` Greg Patnude <gpatnude@hotmail.com>

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