create_distributed_table: include COLLATE on columns

pull/2914/head
Philip Dubé 2019-08-28 22:33:24 +00:00
parent dd57232ba3
commit da00c62eea
3 changed files with 16 additions and 1 deletions

View File

@ -8,7 +8,6 @@
*/
#include "postgres.h"
#include "c.h"
#include "miscadmin.h"
#include <stddef.h>
@ -28,6 +27,7 @@
#include "catalog/pg_attribute.h"
#include "catalog/pg_authid.h"
#include "catalog/pg_class.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_extension.h"
#include "catalog/pg_foreign_data_wrapper.h"
#include "catalog/pg_index.h"
@ -380,6 +380,13 @@ pg_get_tableschemadef_string(Oid tableRelationId, bool includeSequenceDefaults)
{
appendStringInfoString(&buffer, " NOT NULL");
}
if (attributeForm->attcollation != InvalidOid &&
attributeForm->attcollation != DEFAULT_COLLATION_OID)
{
appendStringInfo(&buffer, " COLLATE %s", generate_collation_name(
attributeForm->attcollation));
}
}
}

View File

@ -448,6 +448,13 @@ CREATE TABLE test_schema_support.nation_hash_collation(
n_regionkey integer not null,
n_comment varchar(152)
);
SELECT master_get_table_ddl_events('test_schema_support.nation_hash_collation') ORDER BY 1;
master_get_table_ddl_events
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ALTER TABLE test_schema_support.nation_hash_collation OWNER TO postgres
CREATE TABLE test_schema_support.nation_hash_collation (n_nationkey integer NOT NULL, n_name character(25) NOT NULL COLLATE test_schema_support.english, n_regionkey integer NOT NULL, n_comment character varying(152))
(2 rows)
SELECT master_create_distributed_table('test_schema_support.nation_hash_collation', 'n_nationkey', 'hash');
master_create_distributed_table
---------------------------------

View File

@ -338,6 +338,7 @@ CREATE TABLE test_schema_support.nation_hash_collation(
n_regionkey integer not null,
n_comment varchar(152)
);
SELECT master_get_table_ddl_events('test_schema_support.nation_hash_collation') ORDER BY 1;
SELECT master_create_distributed_table('test_schema_support.nation_hash_collation', 'n_nationkey', 'hash');
SELECT master_create_worker_shards('test_schema_support.nation_hash_collation', 4, 2);