Wednesday 15 June 2011

database partitioning - postgresql partition check on hstore field -


I have a master table that I'm dividing. Everything is fine, except that one of the fields is a hustore type and I would like to check that code to check the value of that hustore key:

  Create Tablet Master_table (id serial, time zero time with built-in time zone, not TIMESTAMP tap with updated time zone, data is now defaults (array []: varchar [])) ;   

For more split:

  create table partition_filld1 (check data-> field '= 1) INHERITS (master_table);   

However, I get the following error:

  Error: Syntax error on or near "data" line1: Create Table Partition_field1 (check data) - & gt; Field ... ^   

Is this possible? Or do I have to properly specify the hustore key?

You forgot the parance on the check constraint. I use the full CONSTRAINT syntax :

  Create Table Partition_field1 (CONSTRAINT data_field_equals_1 CHECK (data-> Fields-> Fields = 1)) INHERITS (master_table);    

No comments:

Post a Comment