Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-15 Thread Vincenzo Romano
2010/1/15 Vincenzo Romano : > 2010/1/15 Pavel Stehule : >> look on this page - maybe it could be useful for you >> http://wiki.postgresql.org/wiki/Sprintf > > This one could save my day! > Thanks Pavel. EXECUTE PRINTF( ); It's great. It's working. It's a must-have-as-builtin! -- Vincenzo

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-15 Thread Pavel Stehule
2010/1/15 Pavel Stehule : > 2010/1/15 Vincenzo Romano : >> 2010/1/15 Pavel Stehule : 3. Then I need to add the TABLE-level CHECK condition in order to exploit the "constraint_exclusion = on":            execute $l2$              alter table $l2$||ct||$l2$              

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-15 Thread Pavel Stehule
2010/1/15 Vincenzo Romano : > 2010/1/15 Pavel Stehule : >>> >>> 3. Then I need to add the TABLE-level CHECK condition in order to >>> exploit the "constraint_exclusion = on": >>>            execute $l2$ >>>              alter table $l2$||ct||$l2$ >>>                add check(  $l0$||co||$l0$ ) >>>

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-15 Thread Vincenzo Romano
2010/1/15 Pavel Stehule : > look on this page - maybe it could be useful for you > http://wiki.postgresql.org/wiki/Sprintf This one could save my day! Thanks Pavel. -- Vincenzo Romano NotOrAnd Information Technologies NON QVIETIS MARIBVS NAVTA PERITVS -- Sent via pgsql-general mailing list (pg

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-15 Thread Vincenzo Romano
2010/1/15 Pavel Stehule : >> >> 3. Then I need to add the TABLE-level CHECK condition in order to >> exploit the "constraint_exclusion = on": >>            execute $l2$ >>              alter table $l2$||ct||$l2$ >>                add check(  $l0$||co||$l0$ ) >>            $l2$ using $l0$||va||$l0$;

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-15 Thread Pavel Stehule
> > 3. Then I need to add the TABLE-level CHECK condition in order to > exploit the "constraint_exclusion = on": >            execute $l2$ >              alter table $l2$||ct||$l2$ >                add check(  $l0$||co||$l0$ ) >            $l2$ using $l0$||va||$l0$; > I am sorry, I am out. Your co

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Vincenzo Romano
2010/1/14 Pavel Stehule : > 2010/1/14 Vincenzo Romano : >> 2010/1/14 Pavel Stehule : >>> 2010/1/14 Vincenzo Romano : 2010/1/14 Adrian Klaver : > On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: >> ... CREATE OR REPLACE FUNCTION f() RETURNS VOID LANGUAGE plpgsq

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Pavel Stehule
2010/1/14 Vincenzo Romano : > 2010/1/14 Pavel Stehule : >> 2010/1/14 Vincenzo Romano : >>> 2010/1/14 Adrian Klaver : On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: > ... >>> CREATE OR REPLACE FUNCTION f() >>> RETURNS VOID >>> LANGUAGE plpgsql >>> AS $function$ >>> DECLARE >>>

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Vincenzo Romano
2010/1/14 Vincenzo Romano : > 2010/1/14 Pavel Stehule : >> 2010/1/14 Vincenzo Romano : >>> 2010/1/14 Adrian Klaver : On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: > ... >>> CREATE OR REPLACE FUNCTION f() >>> RETURNS VOID >>> LANGUAGE plpgsql >>> AS $function$ >>> DECLARE >>>

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Vincenzo Romano
2010/1/14 Pavel Stehule : > 2010/1/14 Vincenzo Romano : >> 2010/1/14 Adrian Klaver : >>> On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: ... >> CREATE OR REPLACE FUNCTION f() >> RETURNS VOID >> LANGUAGE plpgsql >> AS $function$ >> DECLARE >>  cmd TEXT; >> BEGIN >>  EXECUTE ' >>    S

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Pavel Stehule
2010/1/14 Vincenzo Romano : > 2010/1/14 Adrian Klaver : >> On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: >> >>> > >>> > Scott, thanks for that I must have read through that section several >>> > times at least with out picking up on it. >>> > >>> > -- >>> > Adrian Klaver >>> > adr

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Vincenzo Romano
2010/1/14 Adrian Klaver : > On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: > >> > >> > Scott, thanks for that I must have read through that section several >> > times at least with out picking up on it. >> > >> > -- >> > Adrian Klaver >> > adrian.kla...@gmail.com >> >> Really? >> >

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Adrian Klaver
On Wednesday 13 January 2010 10:19:57 pm Vincenzo Romano wrote: > > > > Scott, thanks for that I must have read through that section several > > times at least with out picking up on it. > > > > -- > > Adrian Klaver > > adrian.kla...@gmail.com > > Really? > > That section is not in any page of the

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Pavel Stehule
2010/1/14 Vincenzo Romano : > The documentation says (also in v8.5) "These symbols refer to values > supplied in the USING clause". > "values"and not "variable name or reference". This leads to the useful > feature mentioned a line later in the same page. > Once you have a value replaced you can av

R: Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-14 Thread Vincenzo Romano
The documentation says (also in v8.5) "These symbols refer to values supplied in the USING clause". "values"and not "variable name or reference". This leads to the useful feature mentioned a line later in the same page. Once you have a value replaced you can avoid the restrictions you now mention o

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Tom Lane
Scott Mead writes: >Well it is in 8.5 Devel, so it could have been added immediately after > your thread started yesterday, I'm honestly not sure. The particular paragraph mentioned was committed here http://archives.postgresql.org/pgsql-committers/2009-11/msg00094.php but as you note it was

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Scott Mead
On Thu, Jan 14, 2010 at 7:19 AM, Vincenzo Romano < vincenzo.rom...@notorand.it> wrote: > 2010/1/14 Adrian Klaver : > > On Wednesday 13 January 2010 2:17:51 pm Scott Mead wrote: > >> On Wed, Jan 13, 2010 at 11:00 PM, Vincenzo Romano < > >> > >> vincenzo.rom...@notorand.it> wrote: > >> > It is not t

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Vincenzo Romano
2010/1/14 Adrian Klaver : > On Wednesday 13 January 2010 2:17:51 pm Scott Mead wrote: >> On Wed, Jan 13, 2010 at 11:00 PM, Vincenzo Romano < >> >> vincenzo.rom...@notorand.it> wrote: >> > It is not the check or the select. >> > It is the way the substitution has been implemented. It looks like the

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Adrian Klaver
On Wednesday 13 January 2010 2:17:51 pm Scott Mead wrote: > On Wed, Jan 13, 2010 at 11:00 PM, Vincenzo Romano < > > vincenzo.rom...@notorand.it> wrote: > > It is not the check or the select. > > It is the way the substitution has been implemented. It looks like the > > code replaces the variable na

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Scott Mead
On Wed, Jan 13, 2010 at 11:00 PM, Vincenzo Romano < vincenzo.rom...@notorand.it> wrote: > It is not the check or the select. > It is the way the substitution has been implemented. It looks like the code > replaces the variable name and not the value. > Which is different from what is written at pa

R: Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Vincenzo Romano
It is not the check or the select. It is the way the substitution has been implemented. It looks like the code replaces the variable name and not the value. Which is different from what is written at page 800. I only hope they won't change the manual to match the feature/bug (warning: new joke) Il

Re: R: Re: R: Re: [GENERAL] Weird EXECUTE ... USING behaviour

2010-01-13 Thread Adrian Klaver
On 01/13/2010 01:39 PM, Vincenzo Romano wrote: My issue involves the USING predicates, though. WARNING:Old joke Doctor: What is wrong? Patient: My elbow hurts when I do this, what should I do? Doctor: Quit doing that. USING is not working the way you want, mainly for the reason you found, t