Lists: | pgsql-hackers |
---|
From: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | for statement, adding a STEP clause? |
Date: | 2006-04-29 05:14:17 |
Message-ID: | c2d9e70e0604282214j6a8a3011haac82dce885b4b4a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
there is a chance to add a STEP clause to the FOR statement in plpgsql?
something like
FOR i IN 1..100 STEP 2 LOOP
END LOOP
the STEP value must be a positive value because of the effect of the
REVERSE clause...
i think it's just a matter of fixing gram.y, plpgsql.h (to add
another PLpgSQL_expr to the stmt_fori) and pl_exec.c (the way the
internal variable is incremented here makes me think that i wasn't the
first one with this idea)
i'm missing something? is "STEP" a good name for this? i will make a
try tomorrow
any ideas and suggestions are welcome...
--
regards,
Jaime Casanova
"What they (MySQL) lose in usability, they gain back in benchmarks, and that's
all that matters: getting the wrong answer really fast."
Randal L. Schwartz
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Jaime Casanova" <systemguards(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: for statement, adding a STEP clause? |
Date: | 2006-04-29 05:50:55 |
Message-ID: | 20362.1146289855@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
"Jaime Casanova" <systemguards(at)gmail(dot)com> writes:
> there is a chance to add a STEP clause to the FOR statement in plpgsql?
This is not free: it'd require making STEP a reserved word (at least
within plpgsql) which is contrary to spec. I think you need to make
a pretty good case why the value of the feature outweighs breaking
applications that have perfectly-legally used "step" as an identifier.
regards, tom lane
From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Jaime Casanova <systemguards(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: for statement, adding a STEP clause? |
Date: | 2006-04-29 06:10:19 |
Message-ID: | 4453034B.7000003@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Tom Lane wrote:
>"Jaime Casanova" <systemguards(at)gmail(dot)com> writes:
>
>
>>there is a chance to add a STEP clause to the FOR statement in plpgsql?
>>
>>
>
>This is not free: it'd require making STEP a reserved word (at least
>within plpgsql) which is contrary to spec. I think you need to make
>a pretty good case why the value of the feature outweighs breaking
>applications that have perfectly-legally used "step" as an identifier.
>
>
This isn't available in PL/SQL, is it? That doesn't mean we shouldn't do it, of course, but it might lessen any perceived imperative.
Maybe using BY instad of STEP as the keyword would make it easier, since its occurrence in SQL makes it less likely to be used as a variable.
cheers
andrew