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

From Stephan Szabo
Subject Re: help with dynamic table name
Date
Msg-id 20070305205900.W82091@megazone.bigpanda.com
Whole thread Raw
In response to Re: help with dynamic table name  ("Peter Schonefeld" <peter.schonefeld@gmail.com>)
Responses Re: help with dynamic table name  ("Peter Schonefeld" <peter.schonefeld@gmail.com>)
List pgsql-novice
On Tue, 6 Mar 2007, Peter Schonefeld wrote:

> Hi Jas, thanks for the quick reply...I had started out with the single
> quotes, but had chaged it in my many efforts to get the thing to work...with
> the single quotes i'm getting the error:
>
> "ERROR: 42883: operator does not exist: \"unknown\" + character varying"
>
> ====
>
> 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 +')';

In addition to the conversion to single quotes, you probably mean to be
using || (string concatenation) rather than + (addition) in the above.

pgsql-novice by date:

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