CartoDB / cartodb-postgresql

PostgreSQL extension for CartoDB
BSD 3-Clause "New" or "Revised" License
111 stars 53 forks source link

Avoid name clashing no geom columns provided but existing the_geom #374

Closed rafatower closed 5 years ago

rafatower commented 5 years ago

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
rafatower commented 5 years ago

let me include the missing case for providing just geom column...

Algunenano commented 5 years ago

I think this is also going to clash if my remote table has cartodb_id but I don't use it as identifier.

rafatower commented 5 years ago

The mandatory parameter is excluded as it is filtered by WHERE c NOT IN (id_column...). I added it explicitly, for the sake of clarity.

Algunenano commented 5 years ago

LGTM, but we should have tests for all these cases. I'm almost 100% confident we are going to modify these functions in the future to support more stuff, so these things should all be tested.