From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Getting the currently used sequence for a SERIAL column |
Date: | 2016-10-18 13:45:22 |
Message-ID: | nu591f$5nr$1@blaine.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tom Lane schrieb am 18.10.2016 um 15:20:
>> Furthermore, what's stored in the column seems to be a string of the
>> format "nextval('sequencename'::regclass)". Is there a function to
>> parse this, to return just the sequence name, or will the sequence
>> name always be without for instance a schema name so that a naive
>> parser of our own will do? Googling found no candidates.
>
> Personally, I'd try looking in pg_depend to see if the column's default
> expression has a dependency on a relation of type sequence. That avoids
> all the fun of parsing the expression and turns it into a simple SQL
> join problem.
I thought pg_depend only stores the dependency if the the sequence was assigned
an owning column (through OWNED BY).
I don't see any entries in pg_depend for a simple "default nextval('some_sequence')" expression
but maybe I am just missing something.
Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-10-18 14:11:10 | Re: Getting the currently used sequence for a SERIAL column |
Previous Message | Tom Lane | 2016-10-18 13:20:39 | Re: Getting the currently used sequence for a SERIAL column |