Identifying no-op length coercions - Mailing list pgsql-hackers

From Noah Misch
Subject Identifying no-op length coercions
Date
Msg-id 20110523164234.GA14758@tornado.gateway.2wire.net
Whole thread Raw
Responses Re: Identifying no-op length coercions  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
I'd like to revive the discussion that arose during the last CommitFest over
the proper design for identifying no-op length coercions like varchar(4) ->
varchar(8).  Here is the root of the original debate:
 http://archives.postgresql.org/message-id/20110109220353.GD5777@tornado.leadboat.com

There were two proposals on the table:

1. Attach a "f(from_typmod, to_typmod, is_explicit) RETURNS boolean" function  to the pg_cast; call it in
find_coercion_pathway()
2. Attach a "f(FuncExpr) RETURNS Expr" (actually internal/internal) function  to the pg_proc; call it in
simplify_function()

I tried and failed to write a summary of the respective arguments that could
legitimately substitute for (re-)reading the original thread, so I haven't
included one.  I myself find the advantages of #2 mildly more compelling.

As previously noted, if we enrich the typmod system, only #1 will require
interface changes.  One of the suggestions that came up before was designing
the typmod enrichment before designing this.  Unless someone has short-term
plans to prepare that design, I'd like to avoid serializing on it -- it may
never happen.  One thought: if #1 proves preferable independent of this
concern, should we consider implementing it without documenting it or exposing
it at the SQL level?  External type developers could still directly update
pg_cast, so long as they'll be happy to keep both pieces if we someday change
the required function signature.

Can we reach a design that nobody dislikes excessively?

Thanks,
nm


pgsql-hackers by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: SSI predicate locking on heap -- tuple or row?
Next
From: Robert Haas
Date:
Subject: Re: Identifying no-op length coercions