By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE test (y int, x xml);
INSERT INTO test VALUES (1, '<foo>abc</foo>');
INSERT INTO test VALUES (2, '<bar/>');
SELECT * FROM test;
CREATE TABLE
INSERT 0 1
INSERT 0 1
y | x |
---|---|
1 | <foo>abc</foo> |
2 | <bar/> |
SELECT 2
INSERT INTO test VALUES (3, 'bar');
INSERT INTO test VALUES (4, 'bar<foo>abc</foo>');
SELECT *, x IS DOCUMENT is_XML FROM test;
INSERT 0 1
INSERT 0 1
y | x | is_xml |
---|---|---|
1 | <foo>abc</foo> | t |
2 | <bar/> | t |
3 | bar | f |
4 | bar<foo>abc</foo> | f |
SELECT 4
INSERT INTO test VALUES (5, '<bar');
ERROR: invalid XML content LINE 1: INSERT INTO test VALUES (5, '<bar'); ^ DETAIL: line 1: Couldn't find end of Start Tag bar line 1 <bar ^
INSERT INTO test VALUES (6, '<foo>abc<bar>def</foo></bar>');
ERROR: invalid XML content LINE 1: INSERT INTO test VALUES (6, '<foo>abc<bar>def</foo></bar>'); ^ DETAIL: line 1: Opening and ending tag mismatch: bar line 1 and foo <foo>abc<bar>def</foo></bar> ^ line 1: Opening and ending tag mismatch: foo line 1 and bar <foo>abc<bar>def</foo></bar> ^ line 1: chunk is not well balanced <foo>abc<bar>def</foo></bar> ^