Re: Dynamic DDL

From: "Ketema" <ketema(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Dynamic DDL
Date: 2007-04-16 21:07:09
Message-ID: 1176757629.516626.31010@b75g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Apr 16, 4:47 pm, klep(dot)(dot)(dot)(at)svana(dot)org (Martijn van Oosterhout) wrote:
> On Mon, Apr 16, 2007 at 01:37:43PM -0700, Ketema wrote:
> > create or replace function schema.insert_function(_schema text, _table
> > text) returns integer
>
> <snip>
>
> > set search_path to _schema;
> > insert into _table (columns) values(vals);
>
> <snip>
>
> > is there any whay to get the functionality of above to work with out
> > have to build a string and use the execute function?
>

> No.
>
> Have a nice day,
> --
> Martijn van Oosterhout <klep(dot)(dot)(dot)(at)svana(dot)org> http://svana.org/kleptog/
>
> > From each according to his ability. To each according to his ability to litigate.
>
>
>
> signature.asc
> 1KDownload

Is there a technical reason why not? I'd love to understand why.
This would be really usefull if it were possible.

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

each column that i know can possibly be null I have to wrap in
coalesce so that the null does not cause the whole string to be null,
and therefore unable to be executed. This is annoying and also causes
be to be unable to insert nulls and in some cases it would be nice to
have them.

Thanks

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma Jr 2007-04-16 21:11:07 Re: delete with self join
Previous Message Martijn van Oosterhout 2007-04-16 20:47:13 Re: Dynamic DDL