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

Replace CREATE TABLE […] AS SELECT […] #15092

Merged
merged 1 commit into from Jan 3, 2019

Conversation

@pkerling
Copy link
Member

commented Dec 19, 2018

When MySQL is run with --enforce-gtid-consistency enabled, the
CREATE TABLE […] AS SELECT […] command is not available.
While it is more wordy, use alternatives instead.

Fixes #14893

When MySQL is run with `--enforce-gtid-consistency` enabled, the
`CREATE TABLE […] AS SELECT […]` command is not available.
While it is more wordy, use alternatives instead.

Fixes #14893
@pkerling pkerling self-assigned this Dec 19, 2018
@pkerling pkerling requested a review from kib Dec 19, 2018
@pkerling pkerling changed the title [database] Replace CREATE TABLE […] AS SELECT […] Replace CREATE TABLE […] AS SELECT […] Dec 19, 2018
@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 19, 2018

Note: There is one command left from a schema update in 2015 that I wouldn't want to touch since it's more complicated. Shouldn't be necessary hopefully.

@pkerling pkerling referenced this pull request Dec 19, 2018
1 of 7 tasks complete
@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 19, 2018

jenkins build this please

2 similar comments
@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 20, 2018

jenkins build this please

@MartijnKaijser

This comment has been minimized.

Copy link
Member

commented Dec 20, 2018

jenkins build this please

@pkerling pkerling added this to the Leia 18.0-rc4 milestone Dec 20, 2018
Copy link
Member

left a comment

There are several other instances throughout the code that use CREATE ... AS SELECT ...
As far as I can see you can't cleanly install Kodi with --enforce-gtid-consistency enabled, even with this patch

@kib
kib approved these changes Dec 20, 2018
Copy link
Member

left a comment

Never mind, I overlooked that CREATE VIEW... AS SELECT... does not violate --enforce-gtid-consistency and should be fine.

@kib

This comment has been minimized.

Copy link
Member

commented Dec 21, 2018

@pkerling another option might be to instantiate the database with CREATE TABLE table2 LIKE table1 which is also fine when using --enforce-gtid-consistency but saves on the entire CREATE TABLE statement.

@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 21, 2018

@kib Good tip, but not supported by SQLite

https://www.sqlite.org/lang_createtable.html

@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 21, 2018

I'm not sure what's better - keep as-is (with wordy copy operations) or make database-specific SQL statements?

@Rechi

This comment has been minimized.

Copy link
Member

commented Dec 21, 2018

Keep it as is or how would you know which command to execute?

@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2018

dynamic_cast the db or dataset or add a function to that effect. But I guess for v18 at least we'll just leave it like it is now.

@Rechi

This comment has been minimized.

Copy link
Member

commented Dec 23, 2018

IMO casting will not make the code easier to read. Although the new sql command contains now more words it is straightforward to read.

@pkerling

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2018

OK, let's keep it like this. Now we only need the verification that it works.

@pkerling

This comment has been minimized.

Copy link
Member Author

commented Jan 3, 2019

Confirmed working with a MySQL 8 server and GTID consistency enforced. Merging.

@pkerling pkerling merged commit 86b0a99 into xbmc:master Jan 3, 2019
1 check passed
1 check passed
default You're awesome. Have a cookie
Details
@pkerling pkerling deleted the pkerling:no-create-select branch Jan 3, 2019
@a1rwulf

This comment has been minimized.

Copy link

commented on xbmc/video/VideoDatabase.cpp in ed9c6ac Jan 4, 2019

Is it INSERT INTO xxx SELECT or INSERT INTO xxx AS SELECT ?

This comment has been minimized.

Copy link
Owner Author

replied Jan 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.