Re: [GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Tom Lane
Kevin Murphy <[EMAIL PROTECTED]> writes: > I'm no expert, but per Peter's request, here is a generic > array-unpacking function that works in PostgreSQL 8.0. > [snip] > I would imagine that a type-specific version would be faster. No, actually it'd be exactly the same. What happens under the ho

Re: [GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Kevin Murphy
Peter Fein wrote: Kevin Murphy wrote: As an example, I wrote a function to explode, or unpack, the elements of an array onto separate rows (its return type is SETOF whatever), but it took me a while to figure out how to use it effectively in queries. Mind posting it? I know I've had

Re: [GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Kevin Murphy
Martijn van Oosterhout wrote: On Wed, Aug 03, 2005 at 09:40:26AM -0400, Kevin Murphy wrote: You have to wrap a scalar subquery in its own parentheses even where you might think it to be unnecessary, such as when the subquery is the sole argument to a function. It first guess I imagin

Re: [GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Martijn van Oosterhout
On Wed, Aug 03, 2005 at 09:40:26AM -0400, Kevin Murphy wrote: > You have to wrap a scalar subquery in its own parentheses even where you > might think it to be unnecessary, such as when the subquery is the sole > argument to a function. It first guess I imagine it is because the syntax becomes a

Re: [GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Peter Fein
Kevin Murphy wrote: > I thought this might be helpful in the future to other duffers such as > myself. > > The following is my big contribution to the documentation of the use of > scalar subqueries ;-): > > You have to wrap a scalar subquery in its own parentheses even where you > might think it

[GENERAL] Note on scalar subquery syntax

2005-08-03 Thread Kevin Murphy
I thought this might be helpful in the future to other duffers such as myself. The following is my big contribution to the documentation of the use of scalar subqueries ;-): You have to wrap a scalar subquery in its own parentheses even where you might think it to be unnecessary, such as whe