Skip to content

Error for INSERT IGNORE INTO #160

Description

@Yogurt4

WP Version: 6.8.3
PG4WP Version: 3.4.1

Error:

PHP Warning:  Undefined array key 1 in /var/www/html/wp-content/pg4wp/driver_pgsql.php on line 551
PHP Warning:  pg_query(): Query failed: ERROR:  invalid name syntax
LINE 4:     WHERE  i.indrelid = ''::regclass
                                ^ in /var/www/html/wp-content/pg4wp/driver_pgsql.php on line 478

RAW SQL

INSERT IGNORE INTO `wp_options` ( `option_name`, `option_value`, `autoload` ) VALUES ('update_comment_type.lock', '1760097737', 'no') /* LOCK */

The cause of this error is simple.
driver_pgsql.php, line 550:

        preg_match("/^INSERT INTO\s+`?([a-z0-9_]+)`?/i", $query, $matches);

It parses the original query string, containing no "INSERT INTO" (only "INSERT IGNORE INTO").

I suggest replacing this line with

        preg_match("/^INSERT INTO\s+`?([a-z0-9_]+)`?/i", $sql, $matches);

that works on the already-PostgreSQLized string.

The bug is probably triggered by the WP auto-updater. I saw it every 5 minutes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions