[GENERAL] deduce sequence name from table and column

2005-12-20 Thread Louis-David Mitterrand
Hi,

Is there a way (from DBI) to deduce a sequence name from the table and
column it is attached to?

For instance:

  Column|  Type   |Modifiers
 
-+-+--
 id_fonction | integer | not null default 
nextval(('fonction_id_fonction_seq'::text)::regclass)

I'd like to be able to programmatically find fonction_id_fonction_seq
so that I can then call nextval() on it.

Thanks,

-- 
Only half the people in the world are above average intelligence.

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [GENERAL] deduce sequence name from table and column

2005-12-20 Thread Tom Lane
Louis-David Mitterrand [EMAIL PROTECTED] writes:
 Is there a way (from DBI) to deduce a sequence name from the table and
 column it is attached to?

Since 8.0 you can use pg_get_serial_sequence(), see
http://www.postgresql.org/docs/8.0/static/functions-info.html

regards, tom lane

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [GENERAL] deduce sequence name from table and column

2005-12-20 Thread Louis-David Mitterrand
On Tue, Dec 20, 2005 at 10:31:46AM -0500, Tom Lane wrote:
 Louis-David Mitterrand [EMAIL PROTECTED] writes:
  Is there a way (from DBI) to deduce a sequence name from the table and
  column it is attached to?
 
 Since 8.0 you can use pg_get_serial_sequence(), see
 http://www.postgresql.org/docs/8.0/static/functions-info.html

Just what I needed,
Thanks!

-- 
  -= this .sig is not funny =-

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

   http://archives.postgresql.org