Re: problem with variable

From: "coviolo(at)libero(dot)it" <coviolo(at)libero(dot)it>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: problem with variable
Date: 2010-06-09 14:24:36
Message-ID: 33515231.2920681276093476921.JavaMail.defaultUser@defaultHost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

something like this:

IF (TG_OP = 'UPDATE') THEN
EXECUTE 'CREATE TABLE '||NEW.nome_tabella||' (ordinativo serial PRIMARY KEY
CHECK (nome_tabella = '''||NEW.nome_tabella||'''::text))
INHERITS (database_t);

3 quotes first and 3 quotes after the second variable?

tnx
Luca

>----Messaggio originale----
>Da: tim(at)tim-landscheidt(dot)de
>Data: 09/06/2010 14.02
>A: <pgsql-novice(at)postgresql(dot)org>
>Ogg: Re: [NOVICE] problem with variable
>
>"coviolo(at)libero(dot)it" <coviolo(at)libero(dot)it> wrote:
>
>> When the trigger executes the function which I copy below:
>
>> IF (TG_OP = 'UPDATE') THEN
>> EXECUTE 'CREATE TABLE '||NEW.nome_tabella||' (ordinativo serial PRIMARY
KEY
>> CHECK (nome_tabella = '||NEW.nome_tabella||'::text))
> ^ ^
>> INHERITS (database_t);
>
>> first use of the variable '||NEW.nome_tabella||' is correct and the table
is
>> created with the name, for example "azienda_vallone", but I do not know
why,
>> the second use of the variable is incorrect because the CHECK insert on
table
>> is nome_tabella = azienda_vallone.*.
>> I can not understand why postgresql insert point and asterisk at the end
of
>> the variable.
>> if anyone can give me some suggestions on how to resolve...
>
>You probably need to replace the last two quotes with " ' ' ' ".
>
>Tim
>
>
>--
>Sent via pgsql-novice mailing list (pgsql-novice(at)postgresql(dot)org)
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-novice
>

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Wood 2010-06-09 14:51:18 Re: problem with variable
Previous Message Tim Landscheidt 2010-06-09 12:02:18 Re: problem with variable