Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing [ OF table_name [, ...] ] #164

Open
youngkiu opened this issue Jun 21, 2024 · 0 comments
Open

Missing [ OF table_name [, ...] ] #164

youngkiu opened this issue Jun 21, 2024 · 0 comments

Comments

@youngkiu
Copy link

https://www.postgresql.org/docs/12/sql-select.html

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]
    [ * | expression [ [ AS ] output_name ] [, ...] ]
    [ FROM from_item [, ...] ]
    [ WHERE condition ]
    [ GROUP BY grouping_element [, ...] ]
    [ HAVING condition ]
    [ WINDOW window_name AS ( window_definition ) [, ...] ]
    [ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]
    [ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ]
    [ LIMIT { count | ALL } ]
    [ OFFSET start [ ROW | ROWS ] ]
    [ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]
    [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ]

The [ OF table_name [, ...] ] part is missing below.

https://github.com/oguimbal/pgsql-ast-parser/blob/master/src/syntax/select.ne

select_statement
    -> select_what select_from:? select_where:? (select_groupby select_having:?):? select_order_by:? select_limit_offset:? (select_for select_skip:?):?
    {% x => {
        let [what, from, where, _groupBy, orderBy, limit, _selectFor] = x;
        from = unwrap(from);
        let groupBy = _groupBy && _groupBy[0];
        let having = _groupBy && _groupBy[1];
        groupBy = groupBy && (groupBy.length === 1 && groupBy[0].type === 'list' ? groupBy[0].expressions : groupBy);
        having = having && unwrap(having);
        let selectFor = _selectFor && _selectFor[0];
        let skip = _selectFor && _selectFor[1];
        skip = unwrap(skip);
        return track(x, {
            ...what,
            ...from ? { from: Array.isArray(from) ? from : [from] } : {},
            ...groupBy ? { groupBy } : {},
            ...having ? { having } : {},
            ...limit ? { limit: unwrap(limit) } : {},
            ...orderBy ? { orderBy } : {},
            ...where ? { where } : {},
            ...selectFor ? { for: selectFor[1] } : {},
            ...skip ? { skip } : {},
            type: 'select',
        });
    } %}
@youngkiu youngkiu changed the title [ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } Missing [ OF table_name [, ...] ] [ NOWAIT | SKIP LOCKED ] [...] ] Missing [ OF table_name [, ...] ] Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant