Make WordPress Core

#63777 closed enhancement (fixed)

wpdb::get_table_from_query() doesn't support queries with `SET STATEMENT ... FOR`

Reported by: dd32 Owned by: SergeyBiryukov
Priority: low Milestone: 6.9
Component: Database Version:
Severity: minor Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

MariaDB supports setting various parameters for queries, but wpdb::get_table_from_query() doesn't currently understand this.

​https://mariadb.com/docs/server/reference/sql-statements/administrative-sql-statements/set-commands/set-statement

For example:

wp> var_dump( $wpdb->get_table_from_query( "SET STATEMENT max_statement_time=10 FOR SELECT something FROM table_name WHERE something-is-expensive" ) );
bool(false)

I'm not sure how useful supporting this would be to most WordPress plugins, nor how it would apply to other database engines.

Change History (3)

This ticket was mentioned in ​PR #9374 on ​WordPress/wordpress-develop by ​@dd32.


15 months ago
#1

  • Keywords has-patch has-unit-tests added

#2 @SergeyBiryukov
14 months ago

  • Milestone Awaiting Review → 6.9

#3 @SergeyBiryukov
14 months ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 60622:

Database: Add support for SET STATEMENT in wpdb::get_table_from_query().

MariaDB supports setting various parameters for queries. This commit ensures that wpdb can properly retrieve the table name from such queries.

Reference: ​MariaDB Documentation: SET STATEMENT.

Follow-up to [30345].

Props dd32.
Fixes #63777.

Note: See TracTickets for help on using tickets.