C1|
## Registering an existing table works
R1|
V1| SELECT t.id AS cartodb_id,
    t.geom AS the_geom,
    st_transform(t.geom, 3857) AS the_geom_webmercator,
    t.another_field
   FROM cdb_fs_schema_b904664b5208433cd85a1693ba4f7570.remote_geom t;
S1|1|POINT(1 1)|patata
S1|2|POINT(2 2)|patata2
list_remotes1|(remote_geom,public.remote_geom)
## Registering another existing table works
R2|
V2| SELECT t.id AS cartodb_id,
    t.geom AS the_geom,
    t.geom_mercator AS the_geom_webmercator,
    t.another_field
   FROM cdb_fs_schema_b904664b5208433cd85a1693ba4f7570.remote_geom2 t;
S2|3|POINT(3 3)|patata
list_remotes2|(remote_geom2,"public.""myFullTable""")
list_remotes2|(remote_geom,public.remote_geom)
## Re-registering a table works
R3|
ERROR:  relation "myFullTable" does not exist at character 70
S3_new|3|POINT(3 3)|patata
## Unregistering works
U1|
ERROR:  relation "remote_geom" does not exist at character 71
list_remotes3|(remote_geom2,public.different_name)
## Registering a table: Invalid server fails
ERROR:  Server "Does not exist" does not exist
## Registering a table: NULL server fails
ERROR:  Server name cannot be NULL
## Registering a table: Invalid schema fails
ERROR:  schema "Does not exist" is not present on foreign server "cdb_fs_loopback"
## Registering a table: NULL schema fails
ERROR:  Schema name cannot be NULL
## Registering a table: Invalid table fails
ERROR:  relation "cdb_fs_schema_b904664b5208433cd85a1693ba4f7570.Does not exist" does not exist
## Registering a table: NULL table fails
ERROR:  Remote table name cannot be NULL
## Registering a table: Invalid id fails
ERROR:  non integer id_column "Does not exist"
## Registering a table: NULL id fails
ERROR:  non integer id_column "<NULL>"
## Registering a table: Invalid geom_column fails
ERROR:  non geometry column "Does not exists"
## Registering a table: NULL geom_column is OK


## Registering a table: Invalid webmercator_column fails
ERROR:  non geometry column "Does not exists"
## Registering a table: NULL webmercator_column is OK


## Target conflict is handled nicely: Table
CREATE TABLE
ERROR:  Could not import table "remote_geom" as "localtable": "localtable" already exists
## Target conflict is handled nicely: View
CREATE VIEW
ERROR:  Could not import table "remote_geom" as "localtable2": "localtable2" already exists
DROP VIEW
DROP TABLE
D1|
