Re: Odd behavior with 'currval'

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Francisco Olarte <folarte(at)peoplecall(dot)com>
Cc: Steven Hirsch <snhirsch(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Odd behavior with 'currval'
Date: 2018-02-09 15:45:16
Message-ID: CAKFQuwYtTVhK6BLWTw2YiPdMoRgMfTzAJDwpnuxbLGQFn=2LMw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Feb 9, 2018 at 8:27 AM, Francisco Olarte <folarte(at)peoplecall(dot)com>
wrote:

> On Thu, Feb 8, 2018 at 8:12 PM, Steven Hirsch <snhirsch(at)gmail(dot)com> wrote:
> .....
>
> > 2. Why is the currval() function being so blasted dumb? If
> > 'pg_get_serial_sequence' cannot resolve the sequence, it returns NULL. As
> > such, shouldn't the outer currval() also be returning NULL? I cannot
> > imagine a rationale for the current behavior.
>
> Are you sure it does ? http://sqlfiddle.com/#!17/9eecb/9696 shows it
> returning null. ( as expected, if it is defined strict as it should
> and someone has already pointed it ).
>
> Are you sure you are not using pgAdmin or a similar thing which
> displays null as 0 in a numeric field?

​You've missed a response - the observed behavior is an artifact of JDBC
use. PostgreSQL+psql is working as expected.

David J.​

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2018-02-09 15:47:10 Re: Odd behavior with 'currval'
Previous Message Francisco Olarte 2018-02-09 15:27:55 Re: Odd behavior with 'currval'