Hi Chao,

Thanks for review.

On 11/3/26 10:59, Chao Li wrote:
On Nov 3, 2026, at 03:13, Ilia Evdokimov<[email protected]> wrote:

Hi,

On an assertion-enabled build, `pg_restore_extended_stats()` triggers an 
assertion failure in check_all_expr_argnames_valid() when an expression 
statistics object contains an unknown JSON key with an array value

```
CREATE TABLE t (i INT);
CREATE STATISTICS t_stats ON (i + 1) FROM t;
SELECT pg_catalog.pg_restore_extended_stats(
     'schemaname', 'public',
     'relname', 't',
     'statistics_schemaname', 'public',
     'statistics_name', 't_stats',
     'inherited', false,
     'exprs', '[{"unknown": []}]'::jsonb
);

server closed the connection unexpectedly
     This probably means the server terminated abnormally
     before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
```
I doubt this bug is likely to be encountered in practice, but I agree that the 
server should not crash on invalid input anyway.

So do I. Without asserts, the backend enters an infinite loop that does not respond to query cancellation, so it cannot be stopped through normal cancellation.

--
Best regards,
Ilia Evdokimov,
Tantor Labs LLC,
https://tantorlabs.com/

Reply via email to