Skip to content

Wrong conversion of a SELECT request #84

@hahnn

Description

@hahnn

Hello,

There is a conversion issue about a SELECT request made against the wp_posts SQL table as shown below:

---------------------
[1701095314.7028] Error running :
SELECT p.ID FROM wp_posts p WHERE post_type='scheduled-action' AND p.post_status IN ('pending') AND p.post_modified_gmt <= '2023-11-27 14:23:34' AND p.post_password != '' ORDER BY p.post_date_gmt ASC LIMIT 0, 20
---- converted to ----
SELECT p."ID" , p.post_date_gmt FROM wp_posts p WHERE post_type='scheduled-action' AND p.post_status IN ('pending') AND p.post_modified_gmt <= '2023-11-27 14:23:34' AND p.post_password <> 0 ORDER BY p.post_date_gmt ASC LIMIT 20 OFFSET 0
----> ERREUR:  l'opérateur n'existe pas : character varying <> integer
LINE 1: ..._gmt <= '2023-11-27 14:23:34' AND p.post_password <> 0 ORDER...
                                                             ^
HINT:  Aucun opérateur ne correspond au nom donné et aux types d'arguments.
Vous devez ajouter des conversions explicites de type.
---------------------

In the converted result, a conditionnal test has been wrongly updated from:

p.post_password != ''

to

p.post_password <> 0

There is simply no conversion to make here because the column type of p.post_password is varchar and not a numeric one, so it should remain as it is.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions