| From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> | 
|---|---|
| To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
| Cc: | "PG Hackers" <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: best way for export gram.y symbols | 
| Date: | 2008-04-04 05:43:30 | 
| Message-ID: | 162867790804032243r7078d8fanc8450c3ab8196224@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
On 03/04/2008, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> writes:
>  >> What exactly are you trying to accomplish?
>
>  > when I build CASE expression, I have to merge some PLpgSQL_expr
>  > together. Then I have to reparse expr->query and I have to find params
>  > and actualize it.
>
>  There has to be a better way than that.  What CASE syntax are you
>  trying to implement, anyhow?
CASE expr
  WHEN expr [,expr[,...]] THEN
    statements list
END CASE;
CASE
  WHEN expr THEN
    statements list
  WHEN ....
END CASE;
I would to remove repeated evaluation and casting. Transformation to
SQL case statement is simply and fast. I had to add one file to
plpgsql code, but I haven't any redundant  code and code is readable
and simple. But any ideas are welcome.
Current patch is in attachment
>
>                         regards, tom lane
>
| Attachment | Content-Type | Size | 
|---|---|---|
| plpgsql_case.diff | text/x-patch | 18.5 KB | 
| pl_querylex.c | text/x-csrc | 953 bytes | 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavan Deolasee | 2008-04-04 05:48:59 | Re: [HACKERS] ANALYZE getting dead tuple count hopelessly wrong | 
| Previous Message | Tom Lane | 2008-04-04 05:40:35 | Re: [HACKERS] ANALYZE getting dead tuple count hopelessly wrong |