problem with variable

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

Hello everyone

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...

thank you very much
Luca

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Machiel Richards 2010-06-09 11:38:32 Variables in SQL scripts
Previous Message Michael Hadjivassiliou 2010-06-09 00:55:36 Transaction manipulation commands in user defined c functions?