Re: Odd behavior with 'currval' - Mailing list pgsql-general

From Steven Hirsch
Subject Re: Odd behavior with 'currval'
Date
Msg-id alpine.DEB.2.20.1802081343110.5809@z87
Whole thread Raw
In response to Re: Odd behavior with 'currval'  (Melvin Davidson <melvin6925@gmail.com>)
Responses Re: Odd behavior with 'currval'  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Thu, 8 Feb 2018, Melvin Davidson wrote:

> I believe your problem is in your usage.
> In order for currval(regclass) to work, you must first do a
> SELECT nextval(regclass) in your _current transaction_!
> 
> https://www.postgresql.org/docs/9.6/static/functions-sequence.html

I AM doing that.  It is returning zero.  The code is identical to that 
used in all other tables in the schema - all of them work.  This one does 
not - unless I use the INSERT .. RETURNING ..  approach.

I suspect the weirdness with the sequence not being found is part of the 
underlying problem.


-- 


pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: Odd behavior with 'currval'
Next
From: Adrian Klaver
Date:
Subject: Re: Odd behavior with 'currval'