Skip to content

Support TRUNCATE without TABLE #51

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

Closed
swissspidy opened this issue Oct 23, 2023 · 0 comments · Fixed by #66
Closed

Support TRUNCATE without TABLE #51

swissspidy opened this issue Oct 23, 2023 · 0 comments · Fixed by #66
Labels
bug Something isn't working

Comments

@swissspidy
Copy link
Member

From the docs: TRUNCATE [TABLE] tbl_name

You can do TRUNCATE wp_posts but also TRUNCATE TABLE wp_posts.

Right now, the former is not supported and results in a database error (General error: 1 incomplete input).

@swissspidy swissspidy added the bug Something isn't working label Oct 23, 2023
swissspidy added a commit to wp-cli/entity-command that referenced this issue Oct 23, 2023
This works better with the SQLite plugin right now. See WordPress/sqlite-database-integration#51
aristath added a commit that referenced this issue Dec 28, 2023
JanJakes added a commit that referenced this issue May 30, 2025
**List of discovered issues:**

- [x] Data types from `_mysql_data_types_cache` are sometimes not
correctly fetched, as they can be saved in multiple formates (lowercase,
uppercase, with or without backticks).
- [x] MySQL applies type casting when saving data in non-strict mode,
resulting in things like empty string being saved as `0` for an integer,
`0000-00-00 00:00:00` for a date, etc.
- [x] Functional defaults are incorrectly applied in non-strict mode
(`DEFAULT CURRENT_TIMESTAMP` saves a `'CURRENT_TIMESTAMP'` string rather
than the correct value).
- [x] MySQL `BINARY` type is saved as `INTEGER`, but it's actually a
binary string, and `BLOB` would be more suitable.
- [x] MySQL supports date and time components without a zero padding,
but that doesn't work with date and time functions in SQLite. (E.g.:
`2025-3-7 9:5:2` is a valid datetime/timestamp value in MySQL, but
SQLite requires it to be `2025-03-07 09:05:02`.)
- [x] In multi-process environments (php-fpm), concurrent writes can
cause "SQLSTATE[HY000]: General error: 5 database is locked"
(`SQLITE_BUSY`).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant