From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | m(dot)overmeyer(at)yahoo(dot)ca |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #14289: Potential bug: "invalid attribute number" when dblink result is assigned in PL/PGSQL |
Date: | 2016-08-18 18:51:57 |
Message-ID: | 19568.1471546317@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
m(dot)overmeyer(at)yahoo(dot)ca writes:
> I believe I may have found a bug in PL/PGSQL or dblink.
So you did. Fixed, thanks.
For the archives' sake, the test case looked like
------
create extension dblink;
create table test_table
(
username text primary key
);
INSERT INTO test_table VALUES ('test_user');
CREATE OR REPLACE FUNCTION test_assignment(primary_key_attnums int2vector)
RETURNS text AS
$BODY$
DECLARE
results text;
BEGIN
-- This doesn't work:
results := dblink_build_sql_delete('test_table', primary_key_attnums, 1, ARRAY['test_user']::text[]);
-- But this one (use value instead of parameter) does work:
--results := dblink_build_sql_delete('test_table', '1'::int2vector, 1, ARRAY['test_user']::text[]);
--And so does this one:
-- SELECT dblink_build_sql_delete('test_table', primary_key_attnums, 1, ARRAY['test_user']::text[]) INTO results;
return results;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
SELECT test_assignment('1'::int2vector);
-----
and the problem was that plpgsql thought it could convert the int2vector
argument into an "expanded array". But int2vector doesn't allow toasting
so a fortiori it can't handle being expanded.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | rotten | 2016-08-18 19:06:23 | BUG #14290: materialized view refresh doesn't use temp_tablespace |
Previous Message | Joe Conway | 2016-08-18 18:25:27 | Re: BUG #14289: Potential bug: "invalid attribute number" when dblink result is assigned in PL/PGSQL |