Re: SQL Property Graph Queries (SQL/PGQ)

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Amit Langote <amitlangote09(at)gmail(dot)com>, Junwang Zhao <zhjwpku(at)gmail(dot)com>, Vik Fearing <vik(at)postgresfriends(dot)org>, Ajay Pal <ajay(dot)pal(dot)k(at)gmail(dot)com>, Imran Zaheer <imran(dot)zhir(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL Property Graph Queries (SQL/PGQ)
Date: 2025-12-17 08:58:22
Message-ID: 22769c90-e524-4bab-bc1c-23e6b8bd83bb@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17.12.25 06:32, Ashutosh Bapat wrote:
> On Mon, Dec 15, 2025 at 6:43 PM Ashutosh Bapat
> <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>>
>> Rebased patches on the latest HEAD which required me to move
>> graph_table.sql to another parallel group.
>
> Huh, the movement resulted in losing that test from parallel_schedule.
> Fixed in the attached patches.

A couple of items:

1) I was running some tests that involved properties with mismatching
typmods, and I got an error message like

ERROR: property "p1" data type modifier mismatch: 14 vs. 19

but the actual types were varchar(10) and varchar(15). So to improve
that, we need to run these through the typmod formatting routines, not
just print the raw typmod numbers. I actually just combined that with
the check for the type itself. Also, there was no test covering this,
so I added one. See attached patches.

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.

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.

There was also a bit of an inconsistency in the presentation: The
documentation introduced the colon as seemingly the preferred syntax,
but ruleutils.c dumped out the IS syntax.

(It was also a bit curious that some test code put spaces around the
colon, which is not idiomatic.)

Looking around at other implementations: Oracle does not support it;
DuckDB supports it, but it doesn't seem to be very up to date, so I
don't know what the thinking there is; Google does support it, but it
seems their syntax is more of a PGQ-GQL hybrid, so it's not a good
reference.

Attached is a patch that shows how to revert the colon support. It's
pretty simple, and it would be easy to add it back in later, I think.

Attachment Content-Type Size
0001-Add-test-for-properties-typmod-mismatch.patch.nocfbot text/plain 2.3 KB
0002-Improve-error-message-for-property-typmod-mi.patch.nocfbot text/plain 3.3 KB
0003-Remove-support-for-colon-in-is-label-express.patch.nocfbot text/plain 22.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2025-12-17 09:03:07 Re: Serverside SNI support in libpq
Previous Message Zhijie Hou (Fujitsu) 2025-12-17 08:48:33 RE: Proposal: Cascade REPLICA IDENTITY changes to leaf partitions