Re: Sequence names have 64 character limit? - Mailing list pgsql-general

From Jerry Sievers
Subject Re: Sequence names have 64 character limit?
Date
Msg-id 87lizvc4yz.fsf@comcast.net
Whole thread Raw
In response to Re: Sequence names have 64 character limit?  (Carlo Stonebanks <carlo@stonebanks.ca>)
List pgsql-general
Carlo Stonebanks <carlo@stonebanks.ca> writes:

> Thanks Adrian and Jerry.
>
> Technically, the best way to know which sequence a column is dependent on is
> to actually query for it. I have functions which query
> information_schema.columns and run a regex_replace to extract the sequence
> name from the defaulting nextval() expression. This is better than demanding
> that sequence names are predictable, but I wonder if there isn't a better
> query to run that doesn't require parsing texts? Obviously PG knows about
> the sequence's relation, probably via a dependency that finds it by
> rendering the text to regclass to an OID... but this stuff makes me nervous.

Nervous or otherwise, if your sequences are owned by the tables either
by their implicit creation with SERIAL keyword or a later ALTER SEQUENCE
OWNED BY, then querying the class and depend catalogues is your most
reliable bet.

--
Jerry Sievers
Postgres DBA/Development Consulting
e: gsievers19@comcast.net
p: 305.321.1144

pgsql-general by date:

Previous
From: Darren Duncan
Date:
Subject: Re: Access to NEW.column outside of a trigger function.
Next
From: Adrian Klaver
Date:
Subject: Re: Sequence names have 64 character limit?