| From: | Matthew Peter <survivedsushi(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | EXECUTE INSERT BUGS? |
| Date: | 2006-11-07 00:40:48 |
| Message-ID: | 20061107004048.68841.qmail@web35208.mail.mud.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
create table test (col text);
create or replace function tester() RETURNS void AS $$
DECLARE
cmd text;
v_value text := null;
-- ^^^ right here, NULL makes the querystring fail by setting cmd =
null
BEGIN
cmd := 'INSERT INTO test (
col
) values ( '
|| quote_literal(v_value) || ');';
EXECUTE cmd;
END;
$$ LANGUAGE plpgsql;
test=# \i /tmp/test
CREATE TABLE
CREATE FUNCTION
test=# select * from tester();
ERROR: cannot EXECUTE a null querystring
CONTEXT: PL/pgSQL function "tester" line 12 at execute statement
Also, if v_value is set to boolean then quote_literal(v_value) throws error
____________________________________________________________________________________
Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | AgentM | 2006-11-07 00:40:54 | Re: database name aliases? |
| Previous Message | Reece Hart | 2006-11-07 00:29:33 | Re: database name aliases? |