From 91b1648f12d36b54b483d2a38c98e1e548b64346 Mon Sep 17 00:00:00 2001 From: Carla Date: Tue, 19 Jul 2016 12:55:40 +0200 Subject: [PATCH] test add index --- client/sql/20_table_augmentation.sql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/sql/20_table_augmentation.sql b/client/sql/20_table_augmentation.sql index 8b6cf09..5b0544b 100644 --- a/client/sql/20_table_augmentation.sql +++ b/client/sql/20_table_augmentation.sql @@ -126,6 +126,11 @@ RETURNS boolean AS $$ .format(username=plpy.quote_nullable(username), orgname=plpy.quote_nullable(orgname), server_schema=plpy.quote_literal(server_schema), server_table_name=plpy.quote_literal(server_table_name), fdw_server=plpy.quote_literal(server_name)) ) + # Add index to cartodb_id + plpy.execute('CREATE UNIQUE INDEX {table_name}_pkey ON "{user_schema}".{table_name} (cartodb_id)' + .format(user_schema=user_schema, table_name=table_name) + ) + # Prepare table to receive augmented results in new columns for idx, column in enumerate(colnames_arr): if colnames_arr[idx] is not 'the_geom':