Thread

  1. Re: SQL Property Graph Queries (SQL/PGQ)

    Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> — 2025-12-30T09:44:02Z

    On Thu, Dec 18, 2025 at 2:45 PM Ashutosh Bapat
    <ashutosh.bapat.oss@gmail.com> wrote:
    >
    >
    > >
    > > I did another investigation about whether this level of checking is
    > > necessary.  I think according to the letter of the SQL standard, the
    > > typmods must indeed match.  It seems Oracle does not check (the example
    > > mentioned above came from an Oracle source).  But I think it's okay to
    > > keep the check.  In PostgreSQL, it is much less common to write like
    > > varchar(1000).  And we can always consider relaxing it later.
    >
    > +1.
    >
    > Attached patch adds a couple more test statements.
    >
    
    Squashed this into the main patchset.
    
    > >
    > > 2) I had it in my notes to consider whether we should support the colon
    > > syntax for label expressions.  I think we might have talked about that
    > > before.
    > >
    > > I'm now leaning toward not supporting it in the first iteration.  I
    > > don't know that we have fully explored possible conflicts with host
    > > variable syntax in ecpg and psql and the like.  Maybe avoid that for now.
    > >
    >
    > I was aware of ecpg and I vaguely remember we fixed something in ECPG
    > to allow : in MATCH statement. Probably following changes in
    > psqlscan.l and pgc.l
    > -self                   [,()\[\].;\:\+\-\*\/\%\^\<\>\=]
    > +self                   [,()\[\].;\:\|\+\-\*\/\%\^\<\>\=]
    >
    > Those changes add | after : (and not the : itself) so maybe they are
    > not about supporting : . Do you remember what those are?
    
    I reverted those changes from both the files and ran "meson test". I
    did not observe any failure. It seems those changes are not needed.
    But adding them as a separate commit (0004) in case CI bot reveals any
    failures without them.
    
    I noticed that there were no ECPG tests for SQL/PGQ. Added a basic
    test in patch 0003.
    
    >
    > I spotted some examples that use : in ddl.sgml.
    > <programlisting>
    > SELECT customer_name FROM GRAPH_TABLE (myshop MATCH
    > (c:customer)-[:has]->(o:"order" WHERE o.ordered_when = current_date)
    > COLUMNS (c.name AS customer_name));
    > </programlisting>
    >
    > The query demonstrates that one can use label names in a way that will
    > make the pattern look like an English sentence. Replacing : with IS
    > defeats that purpose.
    >
    > As written in that paragraph, the labels serve the purpose of exposing
    > the table with a different logical view (using different label and
    > property names). So we need that paragraph, but I think we should
    > change the example to use IS instead of :. Attached is suggested
    > minimal change, but I am not happy with it. Another possibility is we
    > completely remove that paragraph; I don't think we need to discuss all
    > possible usages the users will come up with.
    >
    > The patch changes one more instance of : by IS. But that's straight forward.
    >
    > In ddl.sgml I noticed a seemingly incomplete sentence
    >    A property graph is a way to represent database contents, instead of using
    >    relational structures such as tables.
    >
    > Represent the contents as what? I feel the complete sentence should be
    > one of the following
    > property graph is a way to represent database contents as a graph,
    > instead of representing those as relational structures OR
    > property graph is another way to represent database contents instead
    > of using relational structures such as tables
    >
    > But I can't figure out what was originally intended.
    
    
    0002 contains some edits to this part of documentation. I think the
    paragraph reads better than before. Let me know what you think.
    
    Please let me know which of 0002 to 0004 look good to you. I will
    squash those into the patchset in the next version.
    
    -- 
    Best Wishes,
    Ashutosh Bapat