Re: array_dims function is poorly behaved

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Lavergne <mlavergn(at)richlava(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: array_dims function is poorly behaved
Date: 2002-02-01 22:11:01
Message-ID: 13363.1012601461@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Marc Lavergne <mlavergn(at)richlava(dot)com> writes:
> Simply use an array_dims() on any non-array type,

There is not a lot to be done about that, I'm afraid, since our type
system doesn't have a concept of "any array type". The only way we
have to declare array_dims() is as a function taking any type at all;
so it can't protect itself against inputs that aren't arrays.

We could add some code in array_dims to try to detect the case where
it's handed a non-array pass-by-reference type; but I don't see how
it can guard against a pass-by-value parameter, which will typically
equate to an invalid pointer :-(

A bulletproof solution would require adding the notion of "any array
type" to the type checking system. That might be a good thing to do
someday, but I'm not planning to hold my breath while waiting...

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-02-01 22:53:02 Re: PostgresSQL 7.1.3 not parsing SELECT portion of SQL correctly
Previous Message Tom Lane 2002-02-01 21:14:00 Re: Sun Solaris 2.5.1 Seg Faults PostgreSQL7.1.3 build com mands