Skip to content

Incorrect statement for newline/tab #154

@Yogurt4

Description

@Yogurt4

WP Version: 6.8.3
PG4WP Version: 3.4.1

Error:

ERROR:  syntax error at or near "SET"
LINE 3:       WHERE term_id IN (23) SET 
                                    ^

RAW SQL

UPDATE wp_term_taxonomy
                                                SET description = ( CASE term_id WHEN 23 THEN 'a:2:{s:2:"en";i:21;s:2:"hu";i:1;}' END )
                                                WHERE term_id IN (23)

Actual Rewritten SQL

UPDATE wp_term_taxonomy
                                                SET description = ( CASE term_id WHEN 23 THEN 'a:2:{s:2:"en";i:21;s:2:"hu";i:1;}' END )
                                                WHERE term_id IN (23) SET 

The problem is caused by the linebreak before SET (without/instead of a space), created by wp-importer.

driver_pgsql_rewrite.php, line 46.

I suggest replacing this line with
list($sql, $end) = preg_split('/\s+SET\s+/i', $sql, 2);
and line 51 with
list($sql, $end) = preg_split('/\s+VALUES/i', $sql, 2);

Wouldn't make a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions