duckdb/duckdb-postgres

ctid cause scan partition sub-table failure

Closed this issue · 1 comments

What happens?

create or replace view biz.gto_action_record as 
SELECT * FROM postgres_scan('postgres://gpadmin:pwd@192.168.0.161:2345/qsf_prod', 'biz', 'rst_ra_skc_org_detail_1_prt_p20221011')
;
select count(*) from biz.gto_action_record;

raise error:

IOException: IO Error: Unable to query Postgres: server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
 server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.

and then cause gp into recovery mode!

To Reproduce

then go to greenplum server, in pg_log directory, in the log file:
we find:

COPY (SELECT NULL FROM ""tenant_yuege_biz"".""rst_ra_skc_org_detail_1_prt_p20221123"" WHERE ctid BETWEEN '(0,0)':                                                                     :tid AND '(4294967295,0)'::tid ) TO STDOUT (FORMAT binary);
",0,,"postgres.c",1639,
2022-11-23 20:40:43.313946 CST,,,p23011,th0,,,2022-11-23 20:40:42 CST,0,con813,cmd2,seg-1,,,,,"PANIC","XX000","Un                                                                     expected internal error: Master process received signal SIGSEGV",,,,,,,0,,,,"1    0x7fd6fb14a630 libpthread.so.0                                                                      <symbol not found> + 0xfb14a630
2    0xf9cc68 postgres <symbol not found> (CXformUtils.cpp:2234)

and I query the ctid, not these values:

SELECT min(ctid),max(ctid) FROM tenant_yuege_biz.rst_ra_skc_org_detail_1_prt_p20221123;--(33554432,2)	(33554435,17469)
SELECT NULL FROM tenant_yuege_biz.rst_ra_skc_org_detail_1_prt_p20221123 WHERE ctid BETWEEN '(33554432,2)'::tid AND '(33554435,17469)'::tid

but, use these values, also raise error and cause gp recovery mode.

but, the success one db, I query the min and max ctid, and then query the table, is OK:

SELECT min(ctid),max(ctid) FROM tenant_qisefang_biz.rst_ra_skc_org_detail_1_prt_p20221123--(11360,7)	(33325,2)
SELECT NULL FROM tenant_qisefang_biz.rst_ra_skc_org_detail_1_prt_p20221123 WHERE ctid BETWEEN '(11360,7)'::tid AND '(33325,2)'::tid

I confused why this sql add the ctid where condition, I think it's unnecessary。
maybe,remove the ctid, can alse support pg views rather than tables?

OS:

centos7

PostgreSQL Version:

9.4(greenplum6.12)

DuckDB Version:

0.6.0

DuckDB Client:

Python

Full Name:

Changzhen Wang

Affiliation:

linezonedata

Have you tried this on the latest master branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree

Thanks for the report! Unfortunately I can't find enough information here to reproduce the issue.