Re: [SQL] function returning array

2004-04-15 Thread Dennis
Joe Conway writes: dennis'# pParsed varchar[]; Make that last line: pParsed varchar[] := ''{}''; That initializes pParsed to an *empty* array. Otherwise pParsed is NULL, and when you attempt to extend a NULL array, e.g. "pParsed[1] = '

Re: [SQL] function returning array

2004-04-15 Thread Joe Conway
Dennis wrote: pg 7.4.1 I should have listed the source for the function. Here is a simplified parseString function and the foo that calls it. dennis=# create or replace function parseString (varchar, varchar) dennis-# RETURNS varchar[] AS ' dennis'# DECLARE dennis'#

Re: [SQL] function returning array

2004-04-15 Thread Dennis
Tom Lane writes: "Dennis" <[EMAIL PROTECTED]> writes: I am trying to return an array from a function and don't seem to be having luck. Seems to work for me ... what PG version are you using? pg 7.4.1 I should have listed the source for the function. Here is a simplified parseString function and

Re: [SQL] function returning array

2004-04-13 Thread Joe Conway
Dennis wrote: I am trying to return an array from a function and don't seem to be having luck. The function seems to work fine, but if I do assignment to an array variable, I get null in the array elements DECLARE results varchar[]; tmpv varchar; BEGIN -- now call func that returns varchar

Re: [SQL] function returning array

2004-04-13 Thread Tom Lane
"Dennis" <[EMAIL PROTECTED]> writes: > I am trying to return an array from a function and don't seem to be having > luck. Seems to work for me ... what PG version are you using? regression=# create function parseString() returns varchar[] as regression-# 'begin return \'{abc,def,ghi}\'; end' lan

[SQL] function returning array

2004-04-13 Thread Dennis
I am trying to return an array from a function and don't seem to be having luck. The function seems to work fine, but if I do assignment to an array variable, I get null in the array elements DECLARE results varchar[]; tmpv varchar; BEGIN -- now call func that returns varchar[] results