Skip to content

normalize_query syntax problems (lisibility) #14

@legrandlegrand

Description

@legrandlegrand

Each exemple can be verified with pgssp_normalize_query() function.

  1. minus sign "-" is removed more than expected:
    select +1.1, -2, 2-1, b-a, b-1
    SELECT +?, ?, ?-?, ba, b?

  2. parenthesis "(" ")" are removed more than expected:
    insert into a values (null)
    INSERT INTO a VALUES ?
    or
    select f(1)
    SELECT f?

  3. Blank is missing:
    select a from t where b=2 order by c
    SELECT a FROM t WHERE b=?ORDER BY c

  4. non quoted identifiers are case sensitive (they should be lowercase):
    select aB,AB,ab,Ab,"xYz","Xyz" from t
    SELECT aB,AB,ab,Ab,"xYz","Xyz" FROM t

  5. variables from replaced literals should be typed:
    select 1, 1.1, 'aa'
    SELECT ?, ?, ?
    (this opens others questions about NULL consideration ...)

  6. following functions are not common litterals, they should not by replaced:
    select CURRENT_DATE, CURRENT_TIME, LOCALTIME, LOCALTIMESTAMP
    SELECT ?, ?, ?, ?

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions