Re: Odd behavior with 'currval'

From: Steven Hirsch <snhirsch(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Odd behavior with 'currval'
Date: 2018-02-08 18:45:38
Message-ID: alpine.DEB.2.20.1802081343110.5809@z87
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

--

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-02-08 18:47:57 Re: Odd behavior with 'currval'
Previous Message Francisco Olarte 2018-02-08 18:34:02 Re: Odd behavior with 'currval'