Thread

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix IF NOT EXISTS in CREATE STATISTICS

  1. Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Bruno Wolff III <bruno@wolff.to> — 2017-06-21T00:42:37Z

    I'm not seeing an obvious error in my attempt to use CREATE STATISTICS 
    IF NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    
    Sample output:
    psql (10beta1)
    Type "help" for help.
    
    o365logs=# select version();
                                                      version                       
                                
    --------------------------------------------------------------------------------
    ----------------------------
     PostgreSQL 10beta1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623
     (Red Hat 4.8.5-11), 64-bit
    (1 row)
    
    o365logs=# CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies) ON record_type, operation FROM logs;
    ERROR:  syntax error at or near "NOT"
    LINE 1: CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies)...
                                 ^
    o365logs=# CREATE STATISTICS logs_corrtest (dependencies) ON record_type, operation FROM logs;
    CREATE STATISTICS
    o365logs=# DROP STATISTICS IF EXISTS logs_corrtest;
    DROP STATISTICS
    o365logs=# 
    
    
    
    
  2. Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Amit Langote <langote_amit_f8@lab.ntt.co.jp> — 2017-06-21T01:15:28Z

    On 2017/06/21 9:42, Bruno Wolff III wrote:
    > I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    > NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    > 
    > Sample output:
    > psql (10beta1)
    > Type "help" for help.
    > 
    > o365logs=# select version();
    >                                                 
    > version                                                 
    > --------------------------------------------------------------------------------
    > 
    > ----------------------------
    > PostgreSQL 10beta1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
    > 20150623
    > (Red Hat 4.8.5-11), 64-bit
    > (1 row)
    > 
    > o365logs=# CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies) ON
    > record_type, operation FROM logs;
    > ERROR:  syntax error at or near "NOT"
    > LINE 1: CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies)...
    
    Looks like a documentation bug if the authors of the feature actually
    meant to implement the following syntax:
    
      CREATE [ IF NOT EXISTS ] STATISTICS
    
    create if not exists statistics words_stats on a, b from words;
    CREATE STATISTICS
    
    create if not exists statistics words_stats on a, b from words;
    NOTICE:  statistics object "words_stats" already exists, skipping
    CREATE STATISTICS
    
    If that's really what's intended, it seems a bit inconsistent with most
    other commands and with DROP STATISTICS [ IF NOT EXISTS ] itself.
    
    Thanks,
    Amit
    
    
    
    
  3. Re: [BUGS] Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Amit Langote <langote_amit_f8@lab.ntt.co.jp> — 2017-06-21T01:55:28Z

    On 2017/06/21 10:15, Amit Langote wrote:
    > On 2017/06/21 9:42, Bruno Wolff III wrote:
    >> I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    >> NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    >>
    >> Sample output:
    >> psql (10beta1)
    >> Type "help" for help.
    >>
    >> o365logs=# select version();
    >>                                                 
    >> version                                                 
    >> --------------------------------------------------------------------------------
    >>
    >> ----------------------------
    >> PostgreSQL 10beta1 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
    >> 20150623
    >> (Red Hat 4.8.5-11), 64-bit
    >> (1 row)
    >>
    >> o365logs=# CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies) ON
    >> record_type, operation FROM logs;
    >> ERROR:  syntax error at or near "NOT"
    >> LINE 1: CREATE STATISTICS IF NOT EXISTS logs_corrtest (dependencies)...
    > 
    > Looks like a documentation bug if the authors of the feature actually
    > meant to implement the following syntax:
    > 
    >   CREATE [ IF NOT EXISTS ] STATISTICS
    > 
    > create if not exists statistics words_stats on a, b from words;
    > CREATE STATISTICS
    > 
    > create if not exists statistics words_stats on a, b from words;
    > NOTICE:  statistics object "words_stats" already exists, skipping
    > CREATE STATISTICS
    > 
    > If that's really what's intended, it seems a bit inconsistent with most
    > other commands and with DROP STATISTICS [ IF NOT EXISTS ] itself.
    
    Here is a patch, just in case, that changes the grammar to accept the
    following syntax instead of the current one:
    
      CREATE STATISTICS [ IF NOT EXIST ] ...
    
    Also added a test.  Documentation already displays the above syntax, so no
    update needed there.
    
    Thanks,
    Amit
    
  4. Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Tom Lane <tgl@sss.pgh.pa.us> — 2017-06-21T02:01:06Z

    Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
    > On 2017/06/21 9:42, Bruno Wolff III wrote:
    >> I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    >> NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    
    > Looks like a documentation bug if the authors of the feature actually
    > meant to implement the following syntax:
    >   CREATE [ IF NOT EXISTS ] STATISTICS
    
    Hm, that is what the grammar supports, but surely it's utterly
    inconsistent with every other usage of IF NOT EXISTS.  Even if
    this was intended and the docs were not, we should fix the grammar
    to match the docs not vice versa.
    
    			regards, tom lane
    
    
    
  5. Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2017-06-21T02:02:10Z

    Bruno Wolff III wrote:
    > I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    > NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    
    You're absolutely right, and this is a bug in the parser -- I probably
    misplaced the IF NOT EXISTS clause while playing with Tomas' parser
    changes.  Here's the fix.  I'm a bit troubled that this change doesn't
    seem to affect any tests, so I'll add some before pushing.
    
    (Now, "statistics" being plural would seem to call for CREATE STATISTICS
    IF NOT EXIST, rather than EXISTS, but I'll put that thought aside on
    account of it being just too weird ...)
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
  6. Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Amit Langote <langote_amit_f8@lab.ntt.co.jp> — 2017-06-21T02:12:51Z

    On 2017/06/21 11:02, Alvaro Herrera wrote:
    > Bruno Wolff III wrote:
    >> I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    >> NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    > 
    > You're absolutely right, and this is a bug in the parser -- I probably
    > misplaced the IF NOT EXISTS clause while playing with Tomas' parser
    > changes.  Here's the fix.  I'm a bit troubled that this change doesn't
    > seem to affect any tests, so I'll add some before pushing.
    
    I posted the same patch but with a test:
    
    https://www.postgresql.org/message-id/38b7d52e-387a-0e47-7525-b8b654ca4bfb%40lab.ntt.co.jp
    
    Forgot to cc you or Tomas.
    
    Thanks,
    Amit
    
    
    
    
  7. Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Alvaro Herrera <alvherre@2ndquadrant.com> — 2017-06-22T17:22:21Z

    Amit Langote wrote:
    > On 2017/06/21 11:02, Alvaro Herrera wrote:
    > > Bruno Wolff III wrote:
    > >> I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    > >> NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    > > 
    > > You're absolutely right, and this is a bug in the parser -- I probably
    > > misplaced the IF NOT EXISTS clause while playing with Tomas' parser
    > > changes.  Here's the fix.  I'm a bit troubled that this change doesn't
    > > seem to affect any tests, so I'll add some before pushing.
    > 
    > I posted the same patch but with a test:
    > 
    > https://www.postgresql.org/message-id/38b7d52e-387a-0e47-7525-b8b654ca4bfb%40lab.ntt.co.jp
    
    Pushed.
    
    -- 
    Álvaro Herrera                https://www.2ndQuadrant.com/
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
  8. Re: Beta 10 parser error for CREATE STATISTICS IF NOT EXISTS

    Amit Langote <langote_amit_f8@lab.ntt.co.jp> — 2017-06-23T00:35:55Z

    On 2017/06/23 2:22, Alvaro Herrera wrote:
    > Amit Langote wrote:
    >> On 2017/06/21 11:02, Alvaro Herrera wrote:
    >>> Bruno Wolff III wrote:
    >>>> I'm not seeing an obvious error in my attempt to use CREATE STATISTICS IF
    >>>> NOT EXISTS. Given this is new, maybe there is a bug in the parser.
    >>>
    >>> You're absolutely right, and this is a bug in the parser -- I probably
    >>> misplaced the IF NOT EXISTS clause while playing with Tomas' parser
    >>> changes.  Here's the fix.  I'm a bit troubled that this change doesn't
    >>> seem to affect any tests, so I'll add some before pushing.
    >>
    >> I posted the same patch but with a test:
    >>
    >> https://www.postgresql.org/message-id/38b7d52e-387a-0e47-7525-b8b654ca4bfb%40lab.ntt.co.jp
    > 
    > Pushed.
    
    Thanks, Alvaro.
    
    Regards,
    Amit