help with dynamic table name - Mailing list pgsql-novice

From Peter Schonefeld
Subject help with dynamic table name
Date
Msg-id 9cc0d1180703051959n7a9beeafp5af897c7b5c41af9@mail.gmail.com
Whole thread Raw
Responses Re: help with dynamic table name
List pgsql-novice
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: "Damian C"
Date:
Subject: Re: Simple DB presence verifier.
Next
From: "Jasbinder Singh Bali"
Date:
Subject: Re: help with dynamic table name