diff options
| author | Andres Freund | 2018-11-27 18:07:03 +0000 |
|---|---|---|
| committer | Andres Freund | 2018-11-27 18:07:03 +0000 |
| commit | b238527664ec6f6c9d00dba4cc2f3dab1c8b8b04 (patch) | |
| tree | 03df0a6229aadc8a458ef673eec64ddd1ee1e64b /src/test | |
| parent | f17889b2214194d7bd33900509bf08959d5a7efa (diff) | |
Fix jit compilation bug on wide tables.
The function generated to perform JIT compiled tuple deforming failed
when HeapTupleHeader's t_hoff was bigger than a signed int8. I'd
failed to realize that LLVM's getelementptr would treat an int8 index
argument as signed, rather than unsigned. That means that a hoff
larger than 127 would result in a negative offset being applied. Fix
that by widening the index to 32bit.
Add a testcase with a wide table. Don't drop it, as it seems useful to
verify other tools deal properly with wide tables.
Thanks to Justin Pryzby for both reporting a bug and then reducing it
to a reproducible testcase!
Reported-By: Justin Pryzby
Author: Andres Freund
Discussion: https://postgr.es/m/20181115223959.GB10913@telsasoft.com
Backpatch: 11, just as jit compilation was
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/create_table.out | 10 | ||||
| -rw-r--r-- | src/test/regress/expected/sanity_check.out | 1 | ||||
| -rw-r--r-- | src/test/regress/sql/create_table.sql | 10 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/test/regress/expected/create_table.out b/src/test/regress/expected/create_table.out index e92748c1ea..b26b4e7b6d 100644 --- a/src/test/regress/expected/create_table.out +++ b/src/test/regress/expected/create_table.out @@ -261,6 +261,16 @@ ERROR: relation "as_select1" already exists CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r'; NOTICE: relation "as_select1" already exists, skipping DROP TABLE as_select1; +-- create an extra wide table to test for issues related to that +-- (temporarily hide query, to avoid the long CREATE TABLE stmt) +\set ECHO none +INSERT INTO extra_wide_table(firstc, lastc) VALUES('first col', 'last col'); +SELECT firstc, lastc FROM extra_wide_table; + firstc | lastc +-----------+---------- + first col | last col +(1 row) + -- check that tables with oids cannot be created anymore CREATE TABLE withoid() WITH OIDS; ERROR: syntax error at or near "OIDS" diff --git a/src/test/regress/expected/sanity_check.out b/src/test/regress/expected/sanity_check.out index c77060d36c..009a89fc1a 100644 --- a/src/test/regress/expected/sanity_check.out +++ b/src/test/regress/expected/sanity_check.out @@ -44,6 +44,7 @@ dupindexcols|t e_star|f emp|f equipment_r|f +extra_wide_table|f f_star|f fast_emp4000|t float4_tbl|f diff --git a/src/test/regress/sql/create_table.sql b/src/test/regress/sql/create_table.sql index 90cc1a578f..c6f048f8c2 100644 --- a/src/test/regress/sql/create_table.sql +++ b/src/test/regress/sql/create_table.sql @@ -277,6 +277,16 @@ CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r'; CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r'; DROP TABLE as_select1; +-- create an extra wide table to test for issues related to that +-- (temporarily hide query, to avoid the long CREATE TABLE stmt) +\set ECHO none +SELECT 'CREATE TABLE extra_wide_table(firstc text, '|| array_to_string(array_agg('c'||i||' bool'),',')||', lastc text);' +FROM generate_series(1, 1100) g(i) +\gexec +\set ECHO all +INSERT INTO extra_wide_table(firstc, lastc) VALUES('first col', 'last col'); +SELECT firstc, lastc FROM extra_wide_table; + -- check that tables with oids cannot be created anymore CREATE TABLE withoid() WITH OIDS; CREATE TABLE withoid() WITH (oids); |
