Re: Wrong command name in writeable-CTE related error messages

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Wrong command name in writeable-CTE related error messages
Дата
Msg-id 966768.1684863600@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Wrong command name in writeable-CTE related error messages  (Markus Winand <markus.winand@winand.at>)
Ответы Re: Wrong command name in writeable-CTE related error messages  (Markus Winand <markus.winand@winand.at>)
Список pgsql-hackers
Markus Winand <markus.winand@winand.at> writes:
> I noticed that errors due to writable CTEs in read-only or non-volatile context say the offensive command is SELECT.

Good point.

> My first thought was that these error messages should mention INSERT, but after looking into the source I’m not sure
anymore.The name of the command is obtained from CreateCommandName(). After briefly looking around it doesn’t seem to
betrivial to introduce something along the line of CreateModifyingCommandName(). 

Yeah, you would have to inspect the plan tree pretty carefully to
determine that.

Given the way the test is written, maybe it'd make sense to forget about
mentioning the command name, and instead identify the table we are
complaining about:

ERROR: table "foo" cannot be modified in a read-only transaction

I don't see any huge point in using PreventCommandIfReadOnly if we
go that way, so no refactoring is needed: just test XactReadOnly
directly.

            regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Tristan Partin"
Дата:
Сообщение: Use COPY for populating all pgbench tables
Следующее
От: Andres Freund
Дата:
Сообщение: Re: memory leak in trigger handling (since PG12)