Re: Why don't we support external input/output functions for the composite types - Mailing list pgsql-hackers

From Isaac Morland
Subject Re: Why don't we support external input/output functions for the composite types
Date
Msg-id CAMsGm5eFdPnogqa9Zk4jJr3j++j-hGK7JP_heQ4HT9GPGhNhYQ@mail.gmail.com
Whole thread Raw
In response to Re: Why don't we support external input/output functions for the composite types  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Thu, 25 Apr 2024 at 17:05, Tom Lane <tgl@sss.pgh.pa.us> wrote:
 
> I think it's confusing and counterintuitive that putting parentheses
> around a subexpression completely changes the meaning. I don't know of
> any other programming language that behaves that way,

I take it that you also don't believe that "2 + 3 * 4" should yield
different results from "(2 + 3) * 4"?

In that expression "2 + 3" is not a subexpression, although "3 * 4" is, thanks to the operator precedence rules.

I could get behind offering an alternative notation, eg "a.b->c does
the same thing as (a.b).c", if we could find a reasonable notation
that doesn't infringe on user operator namespace.  I think that might
be hard to do though, and I don't think the existing notation is so
awful than we should break existing operators to have an alternative.
The business with deprecating => operators a few years ago had the
excuse that "the standard says so", but we don't have that
justification here.

This is one of those areas where it will be difficult at best to do something which makes things work the way people expect without breaking other cases. I certainly would like to be able to use . to extract a field from a composite value without parenthesizing everything, but given the potential for having a schema name that matches a table or field name I would want to be very careful about changing anything.

pgsql-hackers by date:

Previous
From: Frédéric Yhuel
Date:
Subject: Re: New GUC autovacuum_max_threshold ?
Next
From: Heikki Linnakangas
Date:
Subject: Re: Direct SSL connection with ALPN and HBA rules