Re: Dynamic DDL - Mailing list pgsql-general

From Ketema
Subject Re: Dynamic DDL
Date
Msg-id 1176757629.516626.31010@b75g2000hsg.googlegroups.com
Whole thread Raw
In response to Re: Dynamic DDL  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Dynamic DDL
List pgsql-general
On Apr 16, 4:47 pm, klep...@svana.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...@svana.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



pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Dynamic DDL
Next
From: Richard Broersma Jr
Date:
Subject: Re: delete with self join