Re: Dynamic DDL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Ketema" <ketema(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Dynamic DDL
Date: 2007-04-16 22:24:25
Message-ID: 11421.1176762265@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Ketema" <ketema(at)gmail(dot)com> writes:
> I have an example were I have to build a string in the below manner:

> values (' || new.tpv_success_id || ',''' || new.order_date || ''',' ||
> new.tpv_id || ',' || new.ver_code || ',''' || new.agent_name || ''','
> || new.agent_id || ','
> || new.acct_id || ',''' || new.first_name || ''',''' ||
> new.last_name || ''',''' || new.ssn || ''',''' ||
> coalesce(new.dl_number,'') || ''',''' || coalesce(new.spouse_name, '')
> || ''',''' || coalesce(new.spouse_ssn,'') || ''',''' etc...

This looks to me like you're simply willfully ignoring the easy path.
There's nothing there that wouldn't work just as well without EXECUTE,
viz

values (new.tpv_success_id, new.order_date, new.tpv_id, new.ver_code,
new.agent_name, new.agent_id, new.acct_id, new.first_name,
new.last_name, new.ssn, new.dl_number, new.spouse_name, new.spouse_ssn,
etc...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2007-04-16 23:58:59 Re: string fields helps
Previous Message marcelo Cortez 2007-04-16 22:04:54 string fields helps