Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ejsDt-0008KG-IB for pgsql-general@arkaria.postgresql.org; Thu, 08 Feb 2018 19:51:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ejsDr-0004KR-AU for pgsql-general@arkaria.postgresql.org; Thu, 08 Feb 2018 19:51:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ejsDq-0004KI-W4 for pgsql-general@lists.postgresql.org; Thu, 08 Feb 2018 19:51:07 +0000 Received: from mail-qt0-x241.google.com ([2607:f8b0:400d:c0d::241]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ejsDn-0002rc-Jp for pgsql-general@lists.postgresql.org; Thu, 08 Feb 2018 19:51:06 +0000 Received: by mail-qt0-x241.google.com with SMTP id d8so7756285qtm.0 for ; Thu, 08 Feb 2018 11:51:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:in-reply-to:message-id:references:user-agent :mime-version; bh=m69GL1yTT7+5cQDEPwNC7bXJ8CKsx/oBw0VxPxP4elg=; b=U0tnSA46ub8o1fhq9joC5heoQdBDyDAmeynIe17qlfqNbzPZ7wAMbV30dy703bfWxt IDHNJPjP8Mj6pYvrK2jozTzpnLe7VkOULXnD2tc0o66kj7xqSn6WNb5JxxmoFRmpDQH7 GG/szR8GeG15v8/FkEx+5kQaATUheyW3ItTbxCzMNh7wZ0fqbSJy5XsSAyqbp2TCuk0X CXY59w4rqDCufx+Dv2H7shvpoDaqu3oLTlV2Tkocro2MiXav9uPrnXbasNlz4vV8kxRM 4olPI0c6xCyHVreVf5G6+dLj6r7FTvbHvFmchFWHVNNVZCC3kJC3FyHsTz3z5MM0V9uE V8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=m69GL1yTT7+5cQDEPwNC7bXJ8CKsx/oBw0VxPxP4elg=; b=qqxbv480HG1hbhyk5ORYJM0OiY/vLjxMLhi/++73YXUoarvzcl8IVU4/cXbzbipxVb g5dWtQQonUrzNWtR4N/3TtWzM+v6SNUC8CZkPDsB9+X1zFRqOjDC1MRUTiVQGyZbHNij aJMgR1oxL6KDy1rjplv2JD9BWlGrPVOcGvWhseRAyQqcNMgobnM8PndeZlPaWyDI0okK belt1GD6Obvgx8dU3nWwuN/Ivs2DCnC6i4T1FSuj2I8x3qkdk/z4KHa7W9baE0rDRP3+ +xU2RheFJpDRbhr505OfERT0pWA/mP3rcav7GyjUUmKRIx4o0pj/+2HAU3zUYSuzh7zA g4sw== X-Gm-Message-State: APf1xPD+BC1YKaH/ZB7oomoVv2Fl49kedmoNMF/89YhiQLGwtizoV8h0 85lZz8ndb649r86O/RQb+pEamQ== X-Google-Smtp-Source: AH8x224SGPRBrM0ezl7qYab8/B+n2VUDJTMN7xTgZa4GGIt8cUCj9VdEejLhm/CiUhwFu8Q62AN8sg== X-Received: by 10.200.66.76 with SMTP id r12mr517284qtm.113.1518119461641; Thu, 08 Feb 2018 11:51:01 -0800 (PST) Received: from [192.168.245.27] ([65.183.149.206]) by smtp.gmail.com with ESMTPSA id n137sm477890qke.22.2018.02.08.11.51.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 11:51:01 -0800 (PST) Date: Thu, 8 Feb 2018 14:51:00 -0500 (EST) From: Steven Hirsch X-X-Sender: hirsch@z87 To: "pgsql-generallists.postgresql.org" Subject: Re: Odd behavior with 'currval' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-1302789072-1518119461=:5809" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1302789072-1518119461=:5809 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Thu, 8 Feb 2018, David G. Johnston wrote: > On Thu, Feb 8, 2018 at 10:58 AM, Steven Hirsch wrote: > On a hunch, I tried 'SELECT currval(NULL)' to see if it returned '0', but that too returns NULL.  > So, where is the '0' coming from when I do: > > SELECT currval( pg_get_serial_sequence('udm_asset_type_definition','def_id')) > > ? I've already established that the inner expression evaluates to NULL! > > > ​This is indeed unusual...to be specific here pg_get_serial_sequence returns null in lieu of an error for > being unable to locate the indicated sequence.  currval is returning null because it is defined "STRICT" and > so given a null input it will always return null.  currval itself, when provided a non-null input, is going > to error or provide a number (which should never be zero...). > I'm wondering whether someone didn't like the fact that currval errors and instead wrote a overriding > function that instead returns zero? Do you mean "someone" on the PostgreSQL development team - or "someone" at my end? I can assure you there are no overriding functions in either of my databases. I just double-checked this. The only 'currval' procedure is the one defined at installation (in public). Looks like I may have encountered a legitimate bug? -- --8323329-1302789072-1518119461=:5809--