citusdata / pgconfus-tutorial-multi-tenant

Files for the tutorial on Citus & Multi-Tenant Models @ PGConf US 2017
9 stars 9 forks source link

Running schema.sql errors out with missing UUID extension #2

Open ozgune opened 7 years ago

ozgune commented 7 years ago

I used the instructions on the Citus website, and started up a cluster using the CloudFormation template. When I try to create the schema.sql, I get an error message saying that the UUID extension is missing:

postgres=# \i schema.sql
psql:schema.sql:8: ERROR:  function uuid_generate_v4() does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
psql:schema.sql:18: ERROR:  function uuid_generate_v4() does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
psql:schema.sql:20: ERROR:  relation "stores" does not exist
LINE 1: SELECT create_distributed_table('stores', 'store_id');
                                        ^

Citus' sequence support improved in the past two releases. Could we use sequences in this example? If not, could we include the UUID extension as part of the CloudFormation template?

ozgune commented 7 years ago

I take this back. We have the extension available in CF template, but don't have it installed.

I misspelled the extension's name earlier. The following command installs the extension on the machine that you're on:

CREATE EXTENSION "uuid-ossp";

Once we have citus-tools.sql installed by default, we can then create this extension by running citus_run_on_all_workers. We're currently tracking this change in https://github.com/citusdata/citus/issues/986.

lfittl commented 7 years ago

@ozgune Happy to do it either way - I am a fan of UUIDs instead of sequences, but it might be easier to just replace it with SERIAL columns for now.

Do you have a preference on how to proceed?