From: | Xiaoran Wang <fanfuxiaoran(at)gmail(dot)com> |
---|---|
To: | Serpent <serpent7776(at)gmail(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Document that PG_TRY block cannot have a return statement |
Date: | 2024-08-19 04:03:58 |
Message-ID: | CAGjhLkN+W4CEo4VHqhDF5vheRs1NKQrYG+Vz_MxGOqui6AsCTw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
LGTM!
Serpent <serpent7776(at)gmail(dot)com> 于2024年8月15日周四 15:01写道:
> Hi,
>
> What about this wording:
>
> The code that might throw ereport(ERROR) cannot contain any non local
> control flow other than ereport(ERROR) e.g.: return, goto, break, continue.
> In other words once PG_TRY() is executed, either PG_CATCH() or
> PG_FINALLY() must be executed as well.
>
> I used 'code that might throw ereport(ERROR)' for XXX since this is what's
> used earlier in the comment.
>
> On Tue, 12 Sept 2023 at 17:22, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Serpent <serpent7776(at)gmail(dot)com> writes:
>> > I'm talking about this part:
>>
>> > PG_TRY();
>> > {
>> > ... code that might throw ereport(ERROR) ...
>> > }
>>
>> Ah. Your phrasing needs work for clarity then. Also, "return"
>> is hardly the only way to break it; break, continue, or goto
>> leading out of the PG_TRY are other possibilities. Maybe more
>> like "The XXX code must exit normally (by control reaching
>> the end) if it does not throw ereport(ERROR)." Not quite sure
>> what to use for XXX.
>>
>> regards, tom lane
>>
>
--
Best regards !
Xiaoran Wang
From | Date | Subject | |
---|---|---|---|
Next Message | shveta malik | 2024-08-19 04:49:43 | Re: Conflict detection and logging in logical replication |
Previous Message | Robert Haas | 2024-08-19 03:43:56 | Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs |