Re: Detecting autoincrement columns

Started by FarjadFarid(ChkNet)over 10 years ago4 messagesgeneral
Jump to latest
#1FarjadFarid(ChkNet)
farjad.farid@checknetworks.com

Hi all,

Can someone please direct me as how to detect columns (serial) with
autoincrement option ?

Many thanks.

Best Regards

Farjad Farid

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: FarjadFarid(ChkNet) (#1)

"FarjadFarid\(ChkNet\)" <farjad.farid@checknetworks.com> writes:

Can someone please direct me as how to detect columns (serial) with
autoincrement option ?

They have a default that depends on a nextval() call.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Melvin Davidson
melvin6925@gmail.com
In reply to: Tom Lane (#2)

Try this:

SELECT *
FROM information_schema.columns
WHERE UPPER(column_default) LIKE 'NEXTVAL%'
ORDER BY 1, 2, 3;

On Tue, Sep 1, 2015 at 6:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

"FarjadFarid\(ChkNet\)" <farjad.farid@checknetworks.com> writes:

Can someone please direct me as how to detect columns (serial) with
autoincrement option ?

They have a default that depends on a nextval() call.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.

#4FarjadFarid(ChkNet)
farjad.farid@checknetworks.com
In reply to: Melvin Davidson (#3)

Many thanks.

From: Melvin Davidson [mailto:melvin6925@gmail.com]
Sent: 02 September 2015 00:20
To: Tom Lane
Cc: FarjadFarid(ChkNet); pgsql-general@postgresql.org
Subject: Re: [GENERAL] Detecting autoincrement columns

Try this:

SELECT *
FROM information_schema.columns
WHERE UPPER(column_default) LIKE 'NEXTVAL%'

ORDER BY 1, 2, 3;

On Tue, Sep 1, 2015 at 6:33 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

"FarjadFarid\(ChkNet\)" <farjad.farid@checknetworks.com> writes:

Can someone please direct me as how to detect columns (serial) with
autoincrement option ?

They have a default that depends on a nextval() call.

regards, tom lane

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--

Melvin Davidson
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you. <http://us.i1.yimg.com/us.yimg.com/i/mesg/tsmileys2/01.gif&gt;