escaping and quoting

Started by Maarten Deprezalmost 18 years ago3 messagesgeneral
Jump to latest
#1Maarten Deprez
maarten.deprez@scarlet.be

Hello.

My dbmail server using postgresql produces a lot of warnings about '\\'
in strings. The particular string it is complaining about is escaped by
EscapeBytea, and included in single quotes (not E''). Is it all right to
set standard_compliant_strings to on?

Greetings,
Maarten Deprez

#2Chuck Bai
cbai22@gmail.com
In reply to: Maarten Deprez (#1)
Function to return both integer and SETOF refcursor

I got the following error when try to create a function to return an
integer and SETOF refcursor. I want to get refcursors back along with an
Out parameter in one function. There seems to be a conflict on return
type. How do I fix it? Thanks.

ERROR: function result type must be integer because of OUT parameters

CREATE OR REPLACE FUNCTION testrefcursor(IN uid integer, OUT tcount integer)
RETURNS SETOF refcursor AS
$BODY$
DECLARE
o_user refcursor;
o_name refcursor;
BEGIN
tcount := 100; -- add some logic to calculate tcount
OPEN o_user FOR SELECT * FROM usr_table where usr_id = uid;
RETURN NEXT o_user;
OPEN o_name FOR SELECT * FROM temp_table;
RETURN NEXT o_name;
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chuck Bai (#2)
Re: Function to return both integer and SETOF refcursor

Chuck Bai <cbai22@gmail.com> writes:

I got the following error when try to create a function to return an
integer and SETOF refcursor.

You can't. Perhaps it'd be enough to return the same integer value in
each row of the output?

regards, tom lane