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

Fix postgis 12 adscr -> adbin consrc -> conbin #32684

Merged

Conversation

elpaso
Copy link
Contributor

@elpaso elpaso commented Nov 6, 2019

See: #32679

@pcav can you test this patch (with older PG too)?

@elpaso elpaso added Bug Either a bug report, or a bug fix. Let's hope for the latter! backport release-3_10 labels Nov 6, 2019
@pcav
Copy link
Member

pcav commented Nov 6, 2019

Will do ASAP, thanks!

@rouault
Copy link
Contributor

rouault commented Nov 6, 2019

Just noting that it seems we have some copy&paste pattern between dbmanager and the processing tool. Woud be cool factoring that a bit, but likely out of scope of a urgent fix PR

@elpaso
Copy link
Contributor Author

elpaso commented Nov 6, 2019

@rouault yes, I noticed it too. Ideally we should add that kind of information retrieval it to the QgsAbstractDatabaseProviderConnection API.

@@ -534,12 +537,15 @@ def getTableConstraints(self, table):
schema, tablename = self.getSchemaTableName(table)
schema_where = u" AND nspname=%s " % self.quoteString(schema) if schema is not None else ""

sql = u"""SELECT c.conname, c.contype, c.condeferrable, c.condeferred, array_to_string(c.conkey, ' '), c.consrc,
version_number = int(self.getInfo()[0].split(' ')[1].split('.')[0])
con_col_name = 'consrc' if version_number < 12 else 'conbin'
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 you can put <11 here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've not tested 11, I only have 8, 9, 10 and 12 here. Are you sure that 11 does not use consrc too? Looking here it looks like it does: https://www.postgresql.org/docs/11/catalog-pg-constraint.html

Choose a reason for hiding this comment

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

hello, i'm fairly new to GitHub however i'm encountering the same problem. What does 'postgis 12 adscr -> adbin consrc -> conbin mean as a solution'?

@pcav
Copy link
Member

pcav commented Nov 6, 2019

Tested, apparently all OK.
Thanks again.

@pcav
Copy link
Member

pcav commented Nov 6, 2019

AFAICT It was still present but deprecated. Anyway, it's irrelevant, you can drop the comment. Thanks.

@elpaso elpaso merged commit 2efc616 into qgis:master Nov 6, 2019
@elpaso elpaso deleted the dbmanager-postgis12-consrc-conbin-adscr-adbin branch November 6, 2019 18:09
@pcav
Copy link
Member

pcav commented Nov 7, 2019

Thanks!

@elpaso
Copy link
Contributor Author

elpaso commented Nov 7, 2019

No problems!

@agiudiceandrea
Copy link
Contributor

Hi @elpaso, please see #54379.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants