Re: [HACKERS] Troubles with array_ref - Mailing list pgsql-general

From Tom Lane
Subject Re: [HACKERS] Troubles with array_ref
Date
Msg-id 9297.1131487972@sss.pgh.pa.us
Whole thread Raw
In response to Troubles with array_ref  ("Cristian Prieto" <cristian@clickdiario.com>)
Responses Re: [HACKERS] Troubles with array_ref  ("Cristian Prieto" <cristian@clickdiario.com>)
List pgsql-general
"Cristian Prieto" <cristian@clickdiario.com> writes:
> Well, anyway, this is the Stored Function I've been workin on; it simply
> take an array and an integer just to return this item from the array; The
> array could have any kind of elements so I declare it as anyarray (the
> parameter) and anyelement (the return value), please help me, I don't know
> where to get info about it.

You could save yourself a lot of time if you enabled warnings from your
C compiler (eg, -Wall for gcc) and then paid some attention to them.
The last parameter to array_ref is a bool *, not a bool, and I have no
doubt that the backend is crashing while trying to dereference "false".

(Another problem is that the fourth parameter should be -1 not VARSIZE.)

            regards, tom lane

pgsql-general by date:

Previous
From: "Cristian Prieto"
Date:
Subject: Troubles with array_ref
Next
From: Ledina Hido
Date:
Subject: Transactions, Triggers and Error Messages