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

GPKG: fixes to make most operations compatible with PRAGMA foreign_keys=1 #9141

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

rouault
Copy link
Member

@rouault rouault commented Jan 25, 2024

(fixes #9135)

@rouault rouault added this to the 3.9.0 milestone Jan 25, 2024
@coveralls
Copy link
Collaborator

Coverage Status

coverage: 68.815% (+0.004%) from 68.811%
when pulling ddfb901 on rouault:fix_9135
into da8d811 on OSGeo:master.

if (m_nPragmaForeignKeysOldValue)
{
CPL_IGNORE_RET_VAL(
SQLCommand(m_poDS->GetDB(), "PRAGMA foreign_keys = 1"));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think there is no need for setting that value back as that is only a connection wide setting. This connection won't be reused outside the geopackage writer, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe it is not expensive to turn it on, and wouldn't it be better to play safe?

Copy link
Member Author

Choose a reason for hiding this comment

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

This connection won't be reused outside the geopackage writer, right?

Users of the API could potentially run the GDALDataset::ExecuteSQL("PRAGMA foreign_keys = 1") , so better restore to the setting they used

@rouault rouault merged commit e826cc1 into OSGeo:master Jan 29, 2024
32 checks passed
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.

"FOREIGN KEY constraint failed" error with the geopackage driver
5 participants