On Wed, Jan 6, 2021 at 3:29 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 16807
> Logged by: Alexander Lakhin
> Email address: exclusion@gmail.com
> PostgreSQL version: 13.1
> Operating system: Ubuntu 20.04
> Description:
>
> When executing the following query:
> CREATE EXTENSION postgres_fdw;
>
> DO $d$
> BEGIN
> EXECUTE $$CREATE SERVER loopback FOREIGN DATA WRAPPER postgres_fdw
> OPTIONS (dbname '$$||current_database()||$$',
> port '$$||current_setting('port')||$$'
> )$$;
> END;
> $d$;
>
> CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
> CREATE TABLE t1 (c1 int NOT NULL);
> CREATE FOREIGN TABLE ft1 (c1 int NOT NULL) SERVER loopback OPTIONS
> (schema_name 'public', table_name 't1');
>
> INSERT INTO t1 SELECT id FROM generate_series(1, 100) id;
> DELETE FROM t1;
>
> ANALYZE ft1;
>
> EXPLAIN
> SELECT t1.c1, t2.c1 FROM ft1 t1 JOIN ft1 t2 ON (t1.c1 = t2.c1) ORDER BY
> t1.c1, t2.c1;
>
> The assert-enabled server crashes with the stacktrace:
Reproduced. Will look into this closely.
Thanks for the report, Alexander!
Best regards,
Etsuro Fujita