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

Add support for PostgreSQL index storage options, and reflection of index storage options and index access methods #179

Merged
merged 3 commits into from Jun 19, 2015

Conversation

hollobon
Copy link
Contributor

@hollobon hollobon commented Jun 3, 2015

Add support for specifying PostgreSQL index storage paramters (e.g.
fillfactor).

See http://www.postgresql.org/docs/9.4/static/sql-createindex.html#SQL-CREATEINDEX-STORAGE-PARAMETERS

Add support for specifying PostgreSQL index storage paramters (e.g.
fillfactor).
@zzzeek
Copy link
Owner

zzzeek commented Jun 3, 2015

i sure wish PG would stop adding features, but this looks good, will try to merge soon

@hollobon
Copy link
Contributor Author

hollobon commented Jun 4, 2015

Thanks. Tbf, index storage parameters have been around for a long while (since 8.2 by the look of it).

@hollobon
Copy link
Contributor Author

hollobon commented Jun 4, 2015

I've added another patch that add support for reflecting index storage options.

@hollobon hollobon changed the title Add support for PostgreSQL index storage parameters Add support for PostgreSQL index storage options, and reflection of index storage options and index access methods Jun 4, 2015
@zzzeek
Copy link
Owner

zzzeek commented Jun 17, 2015

arg, this is right in my inbox and ive been passing over it - I've milestoned it to 1.0.6: https://bitbucket.org/zzzeek/sqlalchemy/issue/3455/add-postgresql-storage-parameters

@@ -2607,7 +2624,8 @@ def get_indexes(self, connection, table_name, schema, **kw):
SELECT
i.relname as relname,
ix.indisunique, ix.indexprs, ix.indpred,
a.attname, a.attnum, NULL, ix.indkey%s
a.attname, a.attnum, NULL, ix.indkey%s,
i.reloptions, am.amname
Copy link
Owner

Choose a reason for hiding this comment

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

eek, < 8.5, does this query work perfectly on PG back to the earliest 8.x versions under all circumstances? the reason the SQL for < 8.5 is here is so the many issues we've had with old versions are no longer impacted by new features in our reflection system.

Copy link
Owner

Choose a reason for hiding this comment

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

OK it works back to 8.3.23 at least. good enough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I did check, should be fine. All the 8.x versions are now EOL so not sure it's worth keeping the special cases around that much longer.

Copy link
Owner

Choose a reason for hiding this comment

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

unfortunately Amazon Redshift implements an old 8.X version of Postgresql, and the PG dialect is the basis for the redshift dialect so this is still a thing.

Copy link

Choose a reason for hiding this comment

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

Indeed this breaks code with redshift. Also the reloptions column doesn't exist in database PostgreSQL 8.1 but exists only in database PostgreSQL 8.2 and up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I understand it, Redshift is a fork of PosgreSQL 8.2. That seems fair enough to fix, I'll look at that.

I don't see a reason why SQLAlchemy should be supporting PostgreSQL 8.1 though, given that it's been EOLed and unsupported since November 2010 (unless another of the forks is based off that version).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, I now find it's 8.0.2 (http://docs.aws.amazon.com/redshift/latest/dg/c_redshift-and-postgres-sql.html). I'll amend with that in mind.

It would be good to have a policy on this, perhaps to support 8.0.2 and the currently active versions of PostgreSQL (which are 9.0-9.4 at the moment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I've created a pull request which should fix this. Tested on PostgreSQL 8.0.2 as I don't have access to a Redshift instance.

@zzzeek zzzeek merged commit af19435 into zzzeek:master Jun 19, 2015
@zzzeek
Copy link
Owner

zzzeek commented Jun 19, 2015

great pull request thanks very much !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants