Loading geometry data cause error " invalid geometry (lwgeom_pg.c:178)" on Tanzu Greenplum
search cancel

Loading geometry data cause error " invalid geometry (lwgeom_pg.c:178)" on Tanzu Greenplum

book

Article ID: 295209

calendar_today

Updated On:

Products

VMware Tanzu Greenplum

Issue/Introduction

When loading geometry data, segment instance crashed with error:

2021-11-04 04:43:41.631223 EDT,"gpadmin","gpadmin",xxxx ,sx1,"ERROR","XX000","parse error
- invalid geometry (lwgeom_pg.c:178)",,"""""P"" <-- parse error at position 2 within geometry",,,,"xxxx
",0,,"lwgeom_pg.c",178,"Stack trace:
1    0xbef7fc postgres errstart (elog.c:557)
2    0x7f7e6bc32f78 postgis-2.5.so <symbol not found> + 0x6bc32f78
3    0x7f7e6bc0a5b0 postgis-2.5.so LWGEOM_in + 0x120
4    0xbfe166 postgres InputFunctionCall (fmgr.c:1933)
5    0x8cc7bd postgres ExecProject (execQual.c:6333)
6    0x8ec678 postgres ExecResult (nodeResult.c:202)
7    0x8bf378 postgres ExecProcNode (execProcnode.c:970)
8    0x8ec5f5 postgres ExecResult (tuptable.h:159)
9    0x8bf378 postgres ExecProcNode (execProcnode.c:970)
10   0x9043f1 postgres ExecDML (tuptable.h:159)
11   0x8bf428 postgres ExecProcNode (execProcnode.c:1133)
12   0x8b6879 postgres <symbol not found> (tuptable.h:159)
13   0x8b753c postgres standard_ExecutorRun (execMain.c:2962)
14   0xa8b6b1 postgres <symbol not found> (pquery.c:290)
15   0xa8bbb3 postgres <symbol not found> (pquery.c:1487)
16   0xa8d307 postgres PortalRun (pquery.c:1022)
17   0xa85829 postgres <symbol not found> (postgres.c:1374)
18   0xa8a46c postgres PostgresMain (postgres.c:5388)
19   0x6b0f25 postgres <symbol not found> (postmaster.c:4472)
20   0xa0fc72 postgres PostmasterMain (postmaster.c:1523)
21   0x6b4cf1 postgres main (main.c:205)
22   0x7f7e83328555 libc.so.6 __libc_start_main + 0xf5
23   0x6c098c postgres <symbol not found> + 0x6c098c
" 

 


Resolution

This is caused by the geometry data column has " " at the beginning and end of this column.

For example:

"POLYGON((xxx,xxx))" 


It's a known issue in postgresql community: 
https://stackoverflow.com/questions/23517430/postgis-invalid-geometry

Please also note that a single quote '  will also cause this error.