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

SQL: handle "DATABASE" and "SCHEMA" keywords specially only when they come after "CREATE" #3674

Merged
merged 1 commit into from
Mar 23, 2023

Commits on Mar 22, 2023

  1. SQL: handle "DATABASE" and "SCHEMA" keywords specially only when they…

    … come after "CREATE"
    
    Close universal-ctags#3636.
    
    The parser emitted the warning, "ignoring null tag in ...",
    when reading "alter database ..." from an input stream.
    The unexpected warning was originally reported in
    https://twitter.com/fujii_masao/status/1619860698997329920.
    
    This fix is inspired by the comment
    (universal-ctags#3636 (comment))
    submitted by Fujii Masao (@MasaoFujii).
    
    Fujii Masao illustrated the way for the correct fix:
    
        Probably it's valid to ignore ALTER statement in PostgreSQL, but
        what about other DBMS? I'm afraid that ALTER statement is not in
        SQL standard and other DBMS may handle the keyword "ALTER"
        differently from PostgreSQL.
    
        The cause of the issue seems that the keywords "DATABASE" and
        "SCHEMA" are processed even if they don't follow "CREATE". That
        is, the following SQL statements can cause ctags to emit warnings.
    
    	ALTER DATABASE ...
    	SELECT * FROM pg_locks WHERE database = ...
    
        To fix the issue, I think that the keywords "DATABASE" and
        "SCHEMA" should be processed only just after the keyword "CREATE"
        is processed. How about something like the following change?
    masatake committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    19f837c View commit details
    Browse the repository at this point in the history