Re: Rules, views, sequences and returned values - Mailing list pgsql-general

From Gregory Wood
Subject Re: Rules, views, sequences and returned values
Date
Msg-id 004401c0b3a9$13ef51f0$7889ffcc@comstock.com
Whole thread Raw
In response to Rules, views, sequences and returned values  (DaVinci <bombadil@wanadoo.es>)
Responses Re: Re: Rules, views, sequences and returned values  (will trillich <will@serensoft.com>)
List pgsql-general
>  I have a table and want to make a view updateable with rules. Table has a
>  sequence that creates default value to primary key when inserting.
>
>  And now the question: Is it posible to return value of primary key from
>  rule of inserting with NEW? Is that value what i would get from extern
>  calling to insert, instead of OID?.

SELECT currval('seq-table-name_seq-field-name_seq');

where seq-table-name is the name of your table (not the view), and
seq-field-name is the name of the primary key.

Greg


pgsql-general by date:

Previous
From: DaVinci
Date:
Subject: Rules, views, sequences and returned values
Next
From: "Jan Wessely"
Date:
Subject: Slow SELECT...IN statements