Skip to content

Commit

Permalink
Fix linux crash
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Dec 13, 2023
1 parent 237231a commit 9c3390e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ SHLIB_LINK := $(LIBS)
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)

PG_VERSION_NUM = $(shell awk '/PG_VERSION_NUM/ { print $$3 }' $(shell $(PG_CONFIG) --includedir-server)/pg_config.h)
PG_VERSION_NUM = $(shell pg_config --version | cut -f2 -d' ' | awk -F. '{printf "%d%04d", $$1, $$2}')
HAS_IMPORT_SCHEMA = $(shell [ $(PG_VERSION_NUM) -ge 90500 ] && echo yes)


# order matters, file first, import last
REGRESS = file pgsql
ifeq ($(HAS_IMPORT_SCHEMA),yes)
Expand Down
2 changes: 1 addition & 1 deletion ogr_fdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ pgDatumFromCString(const char* cstr, const OgrFdwColumn *col, int char_encoding,
char *cstr_decoded;

/* Zero length implies NULL for all non-strings */
if (cstr_len == 0 && col->ogrfldtype != OFTString)
if (cstr_len == 0 && (col->ogrfldtype != OFTString && col->ogrfldtype != OFTStringList))
{
*is_null = true;
return value;
Expand Down
10 changes: 5 additions & 5 deletions output/pgsql.source
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,11 @@ CREATE FOREIGN TABLE array_fdw (
b boolean[]
) SERVER pgserver OPTIONS (layer 'array_local');
SELECT fid, txt, int, flt, b FROM array_fdw;
fid | txt | int | flt | b
-----+----------------+-----------+---------------+-------
1 | {Jim} | {1,2,3} | {3.4,5.6,7.8} | {t,f}
2 | {Jim,NULL,Joe} | {1,3,0,4} | {4.5,0,3.4} | {f,f}
3 | | | |
fid | txt | int | flt | b
-----+--------------+-----------+---------------+-------
1 | {Jim} | {1,2,3} | {3.4,5.6,7.8} | {t,f}
2 | {Jim,"",Joe} | {1,3,0,4} | {4.5,0,3.4} | {f,f}
3 | | | |
(3 rows)

----------------------------------------------------------------------
Expand Down

0 comments on commit 9c3390e

Please sign in to comment.