From: | Marc Millas <marc(dot)millas(at)mokadb(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: syntax question |
Date: | 2021-06-03 21:43:47 |
Message-ID: | CADX_1aYfPCYrby9vjo=vtnWhBXYx4QveLZWKuk3Cnp6Eyj+1ng@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
no pb: I am french, so quite skilled on that topic :-)
there is only 50 bottles of various malt on the presentoir close to my desk
so I must stay reasonnable :-)
Marc MILLAS
Senior Architect
+33607850334
www.mokadb.com
On Thu, Jun 3, 2021 at 11:17 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 6/3/21 1:01 PM, Marc Millas wrote:
> > thanks Adrian, exactly what I was missing :-)
> >
> > about knowing if I should...
> > We have to create a set of triggers (insert, update, delete) within a
> > huge set of tables. and that list of tables, and structure of them can
> > be customized, maintained, ...
> > so we were looking for a standard script to automatize the building of
> > the whole thing, taking list of columns and constraints (for PK)
> > directly from pg_catalog.
> > Now it works :-)
> >
> > but.. why do you ask that question ? is there any king of hidden wolf we
> > didnt see ?
>
> See David Johnston's answer. Nested quoting will drive you to drink(or
> drink more):)
>
>
> >
> >
> > Marc MILLAS
> > Senior Architect
> > +33607850334
> > www.mokadb.com <http://www.mokadb.com>
> >
> >
> >
> > On Thu, Jun 3, 2021 at 9:11 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com
> > <mailto:adrian(dot)klaver(at)aklaver(dot)com>> wrote:
> >
> > On 6/3/21 12:01 PM, Bruce Momjian wrote:
> > > On Thu, Jun 3, 2021 at 08:58:03PM +0200, Marc Millas wrote:
> > >> Hi,
> > >>
> > >> within a function, I want to create another function.
> > >> no pb.
> > >> but if I write:
> > >> declare bidule text;
> > >> begin
> > >> bidule:='myfunc';
> > >> create function bidule() ...
> > >>
> > >>
> > >> it does create a function named bidule and not myfunc.
> > >> so I am obviously missing something too obvious.
> > >
> > > You can't create functions inside of functions; same for
> procedures.
> > >
> >
> > Sure you can:
> >
> > CREATE OR REPLACE FUNCTION public.test_fnc()
> > RETURNS void
> > LANGUAGE plpgsql
> > AS $function$
> > DECLARE
> > bidule text;
> > BEGIN
> > bidule:='myfunc';
> > EXECUTE 'create function ' || bidule || '() RETURNS void language
> > plpgsql AS $fnc$ BEGIN END; $fnc$ ';
> > END;
> >
> >
> > $function$
> >
> > select test_fnc();
> > test_fnc
> > ----------
> >
> > \df myfunc
> > List of functions
> > Schema | Name | Result data type | Argument data types | Type
> > --------+--------+------------------+---------------------+------
> > public | myfunc | void | | func
> >
> >
> > Whether you should is another question.
> >
> >
> > --
> > Adrian Klaver
> > adrian(dot)klaver(at)aklaver(dot)com <mailto:adrian(dot)klaver(at)aklaver(dot)com>
> >
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2021-06-03 21:44:36 | Re: arbitrary "interval" expression OK with "at time zone" but not with "set time zone" — Why? |
Previous Message | Bryn Llewellyn | 2021-06-03 21:40:14 | arbitrary "interval" expression OK with "at time zone" but not with "set time zone" — Why? |