By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,903 Members | 1,104 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,903 IT Pros & Developers. It's quick & easy.

Serial type currval

P: n/a
I am wondering if it's possible to retrieve the current value of a
serial type field without using the name of the corresponding sequence?
I know that currval function takes the sequence name as a parameter, but
I would like to use the name of the serial field instead. Is this
possible?
Thanks.

Oleg

*************************************

This e-mail may contain privileged or confidential material intended for the named recipient only.
If you are not the named recipient, delete this message and all attachments.
Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited.
We reserve the right to monitor e-mail sent through our network.

*************************************

Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Friday 12 September 2003 17:09, Oleg Lebedev wrote:
I am wondering if it's possible to retrieve the current value of a
serial type field without using the name of the corresponding sequence?
I know that currval function takes the sequence name as a parameter, but
I would like to use the name of the serial field instead. Is this
possible?
Thanks.


Well as it happens, a table "foo" with a serial field "bar" will have a
sequence called "foo_bar_seq" - so you can figure it out from the field name.
I don't know if this is *guaranteed* to always be that way, but it's been
that way for a while, and I can't see the developers changing it in a hurry.

Be careful if the name gets too long and gets trimmed.
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #2

P: n/a
On Friday 12 September 2003 17:09, Oleg Lebedev wrote:
I am wondering if it's possible to retrieve the current value of a
serial type field without using the name of the corresponding sequence?
I know that currval function takes the sequence name as a parameter, but
I would like to use the name of the serial field instead. Is this
possible?
Thanks.


Well as it happens, a table "foo" with a serial field "bar" will have a
sequence called "foo_bar_seq" - so you can figure it out from the field name.
I don't know if this is *guaranteed* to always be that way, but it's been
that way for a while, and I can't see the developers changing it in a hurry.

Be careful if the name gets too long and gets trimmed.
--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.