pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ramanujam <innomotive@gmail.com>
To: pgsql-bugs@postgresql.org
Subject: BUG #6213: COPY does not work as expected in a plpgsql function
Date: Mon, 19 Sep 2011 02:55:10 GMT
Message-ID: <201109190255.p8J2tAX0011023@wwwmaster.postgresql.org> (raw)


The following bug has been logged online:

Bug reference:      6213
Logged by:          Ramanujam
Email address:      innomotive@gmail.com
PostgreSQL version: 9.0
Operating system:   linux x86_64
Description:        COPY does not work as expected in a plpgsql function
Details: 

A function like this:

CREATE OR REPLACE FUNCTION test(parm character varying(3)) RETURNS SETOF
integer AS
$BODY$

BEGIN
    COPY (SELECT $1) TO '/tmp/test.txt' CSV;
END;

$BODY$
LANGUAGE plpgsql VOLATILE COST 100 ROWS 100;

Throws an error:
NUM:42P02, DETAILS:there is no parameter $1

Substrituting $1 with parm gives this error:
NUM:42703, DETAILS:column "parm" does not exist



view thread (5+ messages)  latest in thread

Message-ID: <201109190255.p8J2tAX0011023@wwwmaster.postgresql.org>
Permalink:  ../201109190255.p8J2tAX0011023@wwwmaster.postgresql.org/
Also on:    postgresql.org/message-id/201109190255.p8J2tAX0011023@wwwmaster.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: innomotive@gmail.com
  Subject: Re: BUG #6213: COPY does not work as expected in a plpgsql function
  In-Reply-To: <201109190255.p8J2tAX0011023@wwwmaster.postgresql.org>
  References: <201109190255.p8J2tAX0011023@wwwmaster.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox