Re: BUG #19631: currtid2() on a view with GROUP BY ctid crashes with XX000

Поиск
Список
Период
Сортировка
Искать

Re: BUG #19631: currtid2() on a view with GROUP BY ctid crashes with XX000

От:
Pierre Forstmann <pierre.forstmann@gmail.com>
Дата:
Вложения:
Hello,

I think that the that SQLSTATE chosen in unicode_assigned() is wrong: this not a SQL statement syntax error but more a feature not supported for the current database encoding;
ERRCODE_FEATURE_NOT_SUPPORTED is more appropriate.

Maybe you could add a regression test for tid.c ?

Other modifications look  good to me and more difficult to test automatically.

Regards,
PF

Re: BUG #19631: currtid2() on a view with GROUP BY ctid crashes with XX000

От:
Fujii Masao <masao.fujii@gmail.com>
Дата:
On Sun, Sep 13, 2026 at 12:50 AM Ayush Tiwari
 wrote:
> I've added it for now, but personally I don't think it is required.

I agree that the additional test isn't necessary here.

- (errmsg("Unicode categorization can only be performed if server
encoding is UTF8")));
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("Unicode categorization can only be performed if server
encoding is UTF8")));

unicode_norm_form_from_string() and str_casefold() have similar encoding
checks, but use ERRCODE_SYNTAX_ERROR. I think
ERRCODE_FEATURE_NOT_SUPPORTED is more appropriate, so I'd keep it here.
Should we change those two checks to use it too?

  if (!crc_ok)
  ereport(ERROR,
- (errmsg("calculated CRC checksum does not match value stored in file")));
+ (errcode(ERRCODE_DATA_CORRUPTED),
+ errmsg("calculated CRC checksum does not match value stored in file")));

perform_base_backup() has the same control-file CRC check without
an errcode(). Should we add ERRCODE_DATA_CORRUPTED there as well?

> (PS. This patch is intended for master only)

+1

Regards,


-- 
Fujii Masao


Re: BUG #19631: currtid2() on a view with GROUP BY ctid crashes with XX000

От:
Ayush Tiwari <ayushtiwari.slg01@gmail.com>
Дата:
Вложения:
Hi,

Thanks for the review, Fujii-san!

On Fri, 20 Nov 2026 at 21:13, Fujii Masao  wrote:
>
> On Sun, Sep 13, 2026 at 12:50 AM Ayush Tiwari
>  wrote:
> > I've added it for now, but personally I don't think it is required.
>
> I agree that the additional test isn't necessary here.

Dropped it in v3.

> - (errmsg("Unicode categorization can only be performed if server
> encoding is UTF8")));
> + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> + errmsg("Unicode categorization can only be performed if server
> encoding is UTF8")));
>
> unicode_norm_form_from_string() and str_casefold() have similar encoding
> checks, but use ERRCODE_SYNTAX_ERROR. I think
> ERRCODE_FEATURE_NOT_SUPPORTED is more appropriate, so I'd keep it here.
> Should we change those two checks to use it too?

Yeah, makes sense. In v1 I had picked ERRCODE_SYNTAX_ERROR to match
those two, and then only updated unicode_assigned() in v2. Changed both
to ERRCODE_FEATURE_NOT_SUPPORTED in v3 so all three UTF8 checks match.

>   if (!crc_ok)
>   ereport(ERROR,
> - (errmsg("calculated CRC checksum does not match value stored in file")));
> + (errcode(ERRCODE_DATA_CORRUPTED),
> + errmsg("calculated CRC checksum does not match value stored in file")));
>
> perform_base_backup() has the same control-file CRC check without
> an errcode(). Should we add ERRCODE_DATA_CORRUPTED there as well?

Ahh yeah, good catch. Added it there too (the remaining get_controlfile()
callers are all in frontend tools)..

Attached v3.

Regards,
Ayush
FAQ