/postgresql-segfault.sql Secret
Created
September 9, 2021 10:28
PostgreSQL 13.4, 12.8 segfault
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE SCHEMA debug; | |
CREATE TABLE debug.downloaded_images ( | |
itemid text NOT NULL, | |
property text NOT NULL, | |
image_number integer DEFAULT 0 NOT NULL, | |
filename text, | |
download_time timestamp without time zone DEFAULT CURRENT_TIMESTAMP, | |
failures_count integer DEFAULT 0 | |
); | |
COPY debug.downloaded_images (itemid, property, image_number, filename, download_time, failures_count) FROM stdin; | |
1190300 categoryPagePhotoUrl 0 \N 2021-09-02 16:12:39.053552 5 | |
\. | |
ALTER TABLE ONLY debug.downloaded_images | |
ADD CONSTRAINT downloaded_images_pkey PRIMARY KEY (itemid, property, image_number); | |
BEGIN; | |
CREATE TABLE IF NOT EXISTS "debug"."foo" | |
(itemId TEXT, | |
last_update TIMESTAMP, | |
PRIMARY KEY(itemId) | |
); | |
DECLARE "test-cursor-crash" CURSOR WITH HOLD FOR | |
SELECT di.itemId FROM "debug".downloaded_images di | |
LEFT JOIN (SELECT itemId, MIN(last_update) as last_update FROM "debug"."foo" GROUP BY itemId) computed ON di.itemId=computed.itemId | |
WHERE COALESCE(last_update, '1970-01-01') < download_time; | |
FETCH 10000 IN "test-cursor-crash"; | |
COMMIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment