Re: help with dynamic table name - Mailing list pgsql-novice

From Jasbinder Singh Bali
Subject Re: help with dynamic table name
Date
Msg-id a47902760703052027q35e451e4nbaa34eefd4f8cec5@mail.gmail.com
Whole thread Raw
In response to help with dynamic table name  ("Peter Schonefeld" <peter.schonefeld@gmail.com>)
Responses Re: help with dynamic table name  ("Peter Schonefeld" <peter.schonefeld@gmail.com>)
Re: help with dynamic table name  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
try replacing double quotes with single quotes and you should be fine i think
~Jas

 
On 3/5/07, Peter Schonefeld <peter.schonefeld@gmail.com> wrote:
Hi, could someone please let me know what i'm doing wrong here?

CREATE OR REPLACE FUNCTION sc_insert_row(char(32),text,varchar(32)) RETURNS text AS $$

DECLARE sql text;
BEGIN
  sql := "INSERT INTO "+ $3 +" ('id','body') VALUES ("+ $1 +","+ $2 +")";
  EXECUTE sql;
  RETURN '';
END;

$$ LANGUAGE 'plpgsql' VOLATILE;

I get the error: "ERROR: 42703: column \"INSERT INTO \" does not exist"

Cheers
Pete

pgsql-novice by date:

Previous
From: "Peter Schonefeld"
Date:
Subject: help with dynamic table name
Next
From: "Peter Schonefeld"
Date:
Subject: Re: help with dynamic table name