• Alexander Korotkov's avatar
    Implement jsonpath .datetime() method · bffe1bd6
    Alexander Korotkov authored
    This commit implements jsonpath .datetime() method as it's specified in
    SQL/JSON standard.  There are no-argument and single-argument versions of
    this method.  No-argument version selects first of ISO datetime formats
    matching input string.  Single-argument version accepts template string as
    its argument.
    
    Additionally to .datetime() method itself this commit also implements
    comparison ability of resulting date and time values.  There is some difficulty
    because exising jsonb_path_*() functions are immutable, while comparison of
    timezoned and non-timezoned types involves current timezone.  At first, current
    timezone could be changes in session.  Moreover, timezones themselves are not
    immutable and could be updated.  This is why we let existing immutable functions
    throw errors on such non-immutable comparison.  In the same time this commit
    provides jsonb_path_*_tz() functions which are stable and support operations
    involving timezones.  As new functions are added to the system catalog,
    catversion is bumped.
    
    Support of .datetime() method was the only blocker prevents T832 from being
    marked as supported.  sql_features.txt is updated correspondingly.
    
    Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.
    Heavily revised by me.  Comments were adjusted by Liudmila Mantrova.
    
    Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com
    Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com
    Author: Alexander Korotkov, Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Liudmila Mantrova
    Reviewed-by: Anastasia Lubennikova, Peter Eisentraut
    bffe1bd6
pg_proc.dat 542 KB