Avoid name clashing no geom columns provided but existing the_geom
Fix for CDB_SetUp_PG_Federated_Table('server', 'schema', 'table', 'id) when the table contains the_geom and/or the_geom_webmercator columns but they are not part of the input. Otherwise it fails with ERROR: column "the_geom" specified more than once
This commit is contained in:
parent
e0e15a9886
commit
e5b1345311
@ -274,7 +274,7 @@ BEGIN
|
|||||||
-- Get a list of columns excluding the id
|
-- Get a list of columns excluding the id
|
||||||
SELECT ARRAY(
|
SELECT ARRAY(
|
||||||
SELECT quote_ident(c) FROM @extschema@.__ft_getcolumns(src_table) AS c
|
SELECT quote_ident(c) FROM @extschema@.__ft_getcolumns(src_table) AS c
|
||||||
WHERE c <> id_column
|
WHERE c NOT IN (id_column, 'the_geom', 'the_geom_webmercator')
|
||||||
) INTO rest_of_cols;
|
) INTO rest_of_cols;
|
||||||
|
|
||||||
-- Create a view with homogeneous CDB fields
|
-- Create a view with homogeneous CDB fields
|
||||||
|
@ -833,6 +833,18 @@ EOF
|
|||||||
)"
|
)"
|
||||||
sql cdb_testmember_1 "SELECT cartodb_id, another_field, the_geom, the_geom_webmercator FROM remote_table5;" should '1|patata||'
|
sql cdb_testmember_1 "SELECT cartodb_id, another_field, the_geom, the_geom_webmercator FROM remote_table5;" should '1|patata||'
|
||||||
|
|
||||||
|
# It shall work without any geometries, even if the table has the_geom or the_geom_webmercator
|
||||||
|
DATABASE=fdw_target sql postgres 'CREATE TABLE test_fdw.remote_table6 (id int, another_field text, the_geom geometry(Geometry,4326), the_geom_webmercator geometry(Geometry,3857));'
|
||||||
|
DATABASE=fdw_target sql postgres 'GRANT SELECT ON TABLE test_fdw.remote_table6 TO fdw_user;'
|
||||||
|
DATABASE=fdw_target sql postgres "INSERT INTO test_fdw.remote_table6 VALUES (1, 'patata', cartodb.CDB_latLng(0,0), ST_Transform(cartodb.CDB_LatLng(0, 0), 3857));"
|
||||||
|
sql cdb_testmember_1 "SELECT cartodb.CDB_SetUp_PG_Federated_Table(
|
||||||
|
'my_server',
|
||||||
|
'test_fdw',
|
||||||
|
'remote_table6',
|
||||||
|
'id'
|
||||||
|
)"
|
||||||
|
sql cdb_testmember_1 "SELECT cartodb_id, another_field, the_geom, the_geom_webmercator FROM remote_table6;" should '1|patata||'
|
||||||
|
|
||||||
|
|
||||||
# Tear down
|
# Tear down
|
||||||
DATABASE=fdw_target sql postgres 'REVOKE ALL ON ALL TABLES IN SCHEMA test_fdw FROM fdw_user;'
|
DATABASE=fdw_target sql postgres 'REVOKE ALL ON ALL TABLES IN SCHEMA test_fdw FROM fdw_user;'
|
||||||
|
Loading…
Reference in New Issue
Block a user