Re: Array behavior oddities

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Bruce Momjian" <bruce(at)momjian(dot)us>, "PostgreSQL-development" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Array behavior oddities
Date: 2008-01-15 16:34:07
Message-ID: 24814.1200414847@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> Here's something else which confused me just now. Why does the second query
> return NULL instead of an array slice?

Because it isn't a slice expression --- you used colon nowhere, so the
result type is going to be text not text[]. (Remember that the parser
must determine the expression's result type at parse time, so whether
there are enough subscripts can't enter into this.) Our alternatives
here are to throw a subscripting error or return NULL. I'd personally
have gone with throwing an error, I think, but it seems far too late to
revisit that decision.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Schiltknecht 2008-01-15 16:37:14 Re: Declarative partitioning grammar
Previous Message Tom Lane 2008-01-15 16:28:11 Re: SSL over Unix-domain sockets