Re: review: psql: edit function, show function commands patch

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jan Urbański <wulczer(at)wulczer(dot)org>, Postgres - Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: review: psql: edit function, show function commands patch
Date: 2010-08-01 04:15:09
Message-ID: AANLkTinXhZeVu1JwuSAS=SXpLFfYY=e5Vj6WxsaezSFk@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/8/1 Robert Haas <robertmhaas(at)gmail(dot)com>:
> On Sun, Jul 25, 2010 at 11:42 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>>> I'm setting this as ready for committer.
>>
>> Thank you very much
>
> I took a look at this tonight and am a bit mystified by the following bit:
>
> +                       /*
> +                        * PL doesn't calculate first row of function's body
> +                        * when first row is empty. So checks first row, and
> +                        * correct lineno when it is necessary.
> +                        */
>
> Is that true of any PL, or just some particular PL?  Is the behavior
> described here a bug that we should fix, or is it, for some reason,
> considered correct?  Is it documented in our documentation?

it is primary plpgsql issue.

>
> The implementation of first_row_is_empty() looks pretty kludgey, too.
> It seems to me that it will fail completely if the text of the
> function definition happens to contain $function$.
>
> CREATE OR REPLACE FUNCTION boom() RETURNS text LANGUAGE plpgsql AS $$
> BEGIN SELECT '$function$'; END $$;
>

I can enhance algorithm on client side - but it will not be a pretty
code - it better do it on server side - for example
pg_get_formated_functiondef ...

CREATE OR REPLACE FUNCTION pg_get_formated_function_def(in oid,
linenum bool:= false, OUT funcdef text, OUT first_line_isignored bool)

this can remove any ugly code

Regards

Pavel

> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise Postgres Company
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Boxuan Zhai 2010-08-01 05:03:15 Re: merge command - GSoC progress
Previous Message Tom Lane 2010-08-01 03:15:45 Re: ANALYZE versus expression indexes with nondefault opckeytype