From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Michael Schmidt <MichaelMSchmidt(at)msn(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: postgresql experts please help |
Date: | 2007-10-18 22:19:43 |
Message-ID: | Pine.BSO.4.64.0710181817030.15177@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Thu, 18 Oct 2007, Michael Schmidt wrote:
> There is:
>
> SELECT currval(pg_get_serial_sequence('mytab','mycol'));
>
>
> Tried this as an isolated statement and it returned null, so it appears to
> also require that nextval be run before it can work.
>
No one was ever saying otherwise. All this discussion is focused around
the example that Andrei provided where an insert was done on a table with
a serial column.
In your case you're getting NULL because pg_get_serial_sequence returns
NULL for a column that doesn't have a sequence attached to it and currval
is STRICT. If you try this on something that is actually a serial column
you will get the expected error instead of NULL.
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Kris Jurka | 2007-10-18 23:34:36 | Re: Fw: postgresql experts please help |
Previous Message | Michael Schmidt | 2007-10-18 22:11:59 | Re: postgresql experts please help |