Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to create unique indexes #385

Merged
merged 1 commit into from
Mar 24, 2016
Merged

Conversation

mtuncer
Copy link
Member

@mtuncer mtuncer commented Mar 16, 2016

Users can now create unique indexes on partition columns for hash and range distributed tables.

Fixes #130

@mtuncer
Copy link
Member Author

mtuncer commented Mar 16, 2016

Fixes #130

@jasonmp85
Copy link
Contributor

Hey @mtuncer: putting "Fixes" in a comment won't do anything. It needs to be in the pull request's description. I've added it there.

@@ -563,7 +563,7 @@ ProcessAlterTableStmt(AlterTableStmt *alterTableStatement, const char *alterTabl
* supported for distributed tables and errors out if it is not.
*/
static void
ErrorIfUnsupportedIndexStmt(IndexStmt *createIndexStatement)
ErrorIfUnsupportedIndexStmt(Oid relationId, IndexStmt *createIndexStatement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't have to pass relationId to the function. Index statement has RangeVar *relation field. We can use RangeVarGetRelid() to get the relationID.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. however it requires getting another lock. Which should be okay.

@onderkalaci
Copy link
Member

@mtuncer I added some comments to this PR. I'll do the testing after discussing the them.

continue;
}

attributeNumber = get_attnum(relationId, columnName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get_attnum returns InvalidOid for dropped columns. We could detect it here, but, for DDL command propagation we prefer to get the error from the worker nodes as we do it for other error cases. I am noting it here for documentation purposes.

@onderkalaci
Copy link
Member

@mtuncer this looks good, also tested once more. Let's :shipit:

@mtuncer mtuncer force-pushed the feature/unique_index branch from 8bd9c3f to 3c4dadc Compare March 24, 2016 07:11
Users can now create unique indexes on partition columns
for hash and range distributed tables.
@mtuncer mtuncer force-pushed the feature/unique_index branch from 3c4dadc to e74decf Compare March 24, 2016 07:31
@mtuncer mtuncer merged commit a9652da into master Mar 24, 2016
@mtuncer mtuncer deleted the feature/unique_index branch March 24, 2016 07:43
DimCitus pushed a commit that referenced this pull request Jan 10, 2018
Allow users to create unique indexes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants