Support operator class parameters in indexes

(cherry picked from commit defb97b7f5)
pull/5568/head
Marco Slot 2021-10-20 17:02:24 +02:00 committed by Onur Tirtir
parent e19089503e
commit d695deae16
3 changed files with 12 additions and 16 deletions

View File

@ -756,10 +756,15 @@ deparse_shard_index_statement(IndexStmt *origStmt, Oid distrelid, int64 shardid,
{
appendStringInfoString(buffer, "INCLUDE (");
deparse_index_columns(buffer, indexStmt->indexIncludingParams, deparseContext);
appendStringInfoChar(buffer, ')');
appendStringInfoString(buffer, ") ");
}
AppendStorageParametersToString(buffer, indexStmt->options);
if (indexStmt->options != NIL)
{
appendStringInfoString(buffer, "WITH (");
AppendStorageParametersToString(buffer, indexStmt->options);
appendStringInfoString(buffer, ") ");
}
if (indexStmt->whereClause != NULL)
{
@ -958,8 +963,9 @@ deparse_index_columns(StringInfo buffer, List *indexParameterList, List *deparse
/* Commit on postgres: 911e70207703799605f5a0e8aad9f06cff067c63*/
if (indexElement->opclassopts != NIL)
{
ereport(ERROR, errmsg(
"citus currently doesn't support operator class parameters in indexes"));
appendStringInfoString(buffer, "(");
AppendStorageParametersToString(buffer, indexElement->opclassopts);
appendStringInfoString(buffer, ") ");
}
#endif
@ -1091,13 +1097,6 @@ AppendStorageParametersToString(StringInfo stringBuffer, List *optionList)
ListCell *optionCell = NULL;
bool firstOptionPrinted = false;
if (optionList == NIL)
{
return;
}
appendStringInfo(stringBuffer, " WITH (");
foreach(optionCell, optionList)
{
DefElem *option = (DefElem *) lfirst(optionCell);
@ -1114,8 +1113,6 @@ AppendStorageParametersToString(StringInfo stringBuffer, List *optionList)
quote_identifier(optionName),
quote_literal_cstr(optionValue));
}
appendStringInfo(stringBuffer, ")");
}

View File

@ -169,9 +169,8 @@ SELECT create_distributed_table('test_table', 'a');
(1 row)
-- we currently don't support this
-- operator class options are supported
CREATE INDEX test_table_index ON test_table USING gist (b tsvector_ops(siglen = 100));
ERROR: citus currently doesn't support operator class parameters in indexes
-- testing WAL
CREATE TABLE test_wal(a int, b int);
-- test WAL without ANALYZE, this should raise an error

View File

@ -94,7 +94,7 @@ SELECT create_distributed_table('my_table', 'a');
CREATE TABLE test_table(a int, b tsvector);
SELECT create_distributed_table('test_table', 'a');
-- we currently don't support this
-- operator class options are supported
CREATE INDEX test_table_index ON test_table USING gist (b tsvector_ops(siglen = 100));
-- testing WAL