From: Tom Lane <tgl@sss.pgh.pa.us>
To: Chris Bandy <bandy.chris@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6080: information_schema.columns.column_default contains NULL inconsistently
Date: Sun, 03 Jul 2011 12:31:15 -0400
Message-ID: <29289.1309710675@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMDg7WyLbvTGxV4c625KZOphwnjJDDzkrKutVvwzBoC+JAr0yw@mail.gmail.com>
References: <201106282042.p5SKgVjo044969@wwwmaster.postgresql.org>
<107.1309577721@sss.pgh.pa.us>
<CAMDg7WyLbvTGxV4c625KZOphwnjJDDzkrKutVvwzBoC+JAr0yw@mail.gmail.com>
Chris Bandy <bandy.chris@gmail.com> writes:
> On Fri, Jul 1, 2011 at 10:35 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> But AFAICS there is room for implementation dependency in other cases.
>> In the particular cases you show here, PG recognizes some of them as
>> being equivalent to not having a default value, so for efficiency's sake
>> it converts them to that form.
> That makes sense, too. Perhaps I am naive, but a null is a null,
> right? Is the different presentation of defaults for "d" and "e"
> indicative of an *in*efficiency in PG?
Yeah, it's intentional though. What the printout is not telling you
is that there's a hidden cast function invocation to enforce the length
limit in the cases where the column has an explicit length limit. That
is, under the hood the expression is really more like "varchar(NULL, 1)".
The code that recognizes a default expression as being just constant
NULL doesn't think this is a constant NULL. In principle it could
recognize that, since the cast function is marked strict, but so far
it has not seemed worth the trouble.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, bandy.chris@gmail.com
Subject: Re: BUG #6080: information_schema.columns.column_default contains NULL inconsistently
In-Reply-To: <29289.1309710675@sss.pgh.pa.us>
References: <201106282042.p5SKgVjo044969@wwwmaster.postgresql.org> <107.1309577721@sss.pgh.pa.us> <CAMDg7WyLbvTGxV4c625KZOphwnjJDDzkrKutVvwzBoC+JAr0yw@mail.gmail.com> <29289.1309710675@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox