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

Fixes Bug #63814: Allow for index creation with USING and WHERE keywords... #51

Closed
wants to merge 8 commits into from

Conversation

SPodjasek
Copy link
Contributor

... supplied as add_index options

@SPodjasek
Copy link
Contributor Author

Current PostgreSQL version (9.4) allows some other options to be set:

CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] [ name ] ON table_name [ USING method ]
    ( { column_name | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] [, ...] )
    [ WITH ( storage_parameter = value [, ... ] ) ]
    [ TABLESPACE tablespace_name ]
    [ WHERE predicate ]

but nobody asked for them for now

@@ -553,7 +570,10 @@ sub create_index
}
elsif ( $type eq NORMAL ) {
$index_def =
'CREATE INDEX ' . $generator->quote($name) . ' on ' . $generator->quote($table_name) . ' ' . $field_names
'CREATE INDEX ' . $generator->quote($name) . ' on ' . $generator->quote($table_name) .
($index_using ne '' ? ' ' . $index_using : '') .
Copy link
Member

Choose a reason for hiding this comment

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

If you include the leading space when setting the value above, you can get rid of the ugly conditionals here.

@ilmari
Copy link
Member

ilmari commented Jun 24, 2015

Not a prerequisite for merging this, but it would be nice to support this in Parser::PostgreSQL as well. The grammar already parses the clauses it just doesn't store them in the Schema::Index object

@ilmari
Copy link
Member

ilmari commented Jun 24, 2015

It's storing it in the data structure it builds during parsing, but it's not propagating that in the $table->add_index call.

@ribasushi
Copy link
Contributor

@ilmari
Copy link
Member

ilmari commented Jun 25, 2015

@ribasushi No, that's about specifying an explicit conversion when changing column types, it just happens to also use the USING keyword.

@SPodjasek
Copy link
Contributor Author

My Parser::PostgreSQL changes lack support of function fields in indexes, but it is also an issue with Parser::DBI::PostgreSQL (as stated in line 144 there)

@ilmari
Copy link
Member

ilmari commented Jun 28, 2015

Thank you, merged with minor tweaks as 5b36314 and 9c05d80.

@ilmari ilmari closed this Jun 28, 2015
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.

None yet

3 participants