Re: Sequence names have 64 character limit?

From: Jerry Sievers <gsievers19(at)comcast(dot)net>
To: Carlo Stonebanks <carlo(at)stonebanks(dot)ca>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sequence names have 64 character limit?
Date: 2011-03-31 22:14:44
Message-ID: 87lizvc4yz.fsf@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Carlo Stonebanks <carlo(at)stonebanks(dot)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(at)comcast(dot)net
p: 305.321.1144

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2011-03-31 22:15:01 Re: Sequence names have 64 character limit?
Previous Message Darren Duncan 2011-03-31 22:03:45 Re: Access to NEW.column outside of a trigger function.