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 1eoZGG-0000gn-MO for pgsql-interfaces@arkaria.postgresql.org; Wed, 21 Feb 2018 18:37:00 +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 1eoZGF-0001uY-KT for pgsql-interfaces@arkaria.postgresql.org; Wed, 21 Feb 2018 18:36:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eoZGF-0001uP-Bu for pgsql-interfaces@lists.postgresql.org; Wed, 21 Feb 2018 18:36:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eoZGC-0000no-Je for pgsql-interfaces@lists.postgresql.org; Wed, 21 Feb 2018 18:36:58 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w1LIaUtJ021466; Wed, 21 Feb 2018 13:36:30 -0500 From: Tom Lane To: Sebastien FLAESCH cc: pgsql-interfaces@lists.postgresql.org Subject: Re: Type scale returned by PQfmod() 65531 for time/timestamp output parameter? In-reply-to: <5a7de250-aceb-7b61-8da6-796a37a28eca@4js.com> References: <093e1214-7057-f80c-5c3c-74076b7bb555@4js.com> <7537.1518711940@sss.pgh.pa.us> <13939.1518794152@sss.pgh.pa.us> <91fabdcd-0eb3-c970-a28c-248a6ff8a360@4js.com> <7047.1519056383@sss.pgh.pa.us> <2ae51da1-f2b4-a8be-4c4d-c8b96f1f7718@4js.com> <17186.1519137546@sss.pgh.pa.us> <5a7de250-aceb-7b61-8da6-796a37a28eca@4js.com> Comments: In-reply-to Sebastien FLAESCH message dated "Wed, 21 Feb 2018 17:41:44 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21464.1519238190.1@sss.pgh.pa.us> Date: Wed, 21 Feb 2018 13:36:30 -0500 Message-ID: <21465.1519238190@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Sebastien FLAESCH writes: > On 02/20/2018 03:39 PM, Tom Lane wrote: >> Like I said before, it's datatype-specific and you need to look at the >> typmodin/typmodout support functions for each type to see what they do. > Are you suggesting me to dig into the PostgreSQL server sources / internals? Yup. > Any starting point I should look at? regression=# select distinct typmodout from pg_type where typmodout != 0; typmodout ---------------------- intervaltypmodout timestamptypmodout timestamptztypmodout timetypmodout timetztypmodout bpchartypmodout varchartypmodout numerictypmodout bittypmodout varbittypmodout (10 rows) I think all of those are under src/backend/utils/adt/ in the sources. Briefly their charter is to produce the textual representation of a typmod value for the data type, or an empty string if there's no typmod constraint. Although in principle code outside the datatype shouldn't assume anything at all about the encoding of typmod, there's a widespread assumption that all negative values (not just -1) mean "no constraint". regards, tom lane