unexpected unnest behaviour - Mailing list pgsql-general

From James Harper
Subject unexpected unnest behaviour
Date
Msg-id F214C06498BC244DB3F9472E1C5368180F433363@BITCOM1.int.sbss.com.au
Whole thread Raw
Responses Re: unexpected unnest behaviour  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
I have a query that blows the arguments in pg_proc out:

SELECT pg_proc.oid, UNNEST(pg_proc.proargnames), UNNEST(pg_proc.proargtypes), UNNEST(pg_proc.proargmodes) FROM pg_proc

And that works great if all arguments are input arguments, but if two are output arguments, then something unexpected
happens.

So for a proc declared as:

CREATE FUNCTION "master.dbo".xp_instance_regread(OUT tsql_int, "@root" tsql_sysname, "@key" tsql_sysname, "@name"
tsql_sysname,OUT "@value" tsql_sysname) 

My query above returns 15 rows instead of the expected 5. When I investigate I find that proargtypes only contains the
typesof the input arguments and that I should use proallargtypes, and when I do I get the expected results, but the
outputwhen unnest is used on arrays of different sizes was something I didn't expect, and something I can't imagine
anyonemight want... 

Mostly out of curiousity, why is this so?

Thanks

James



pgsql-general by date:

Previous
From: shetty65
Date:
Subject: Unattended Installation
Next
From: Stefan Keller
Date:
Subject: Re: Postgres as In-Memory Database?