pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vik Fearing <vik@postgresfriends.org>
To: Andrew Dunstan <andrew@dunslane.net>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Corey Huinker <corey.huinker@gmail.com>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Error-safe user functions
Date: Sun, 4 Dec 2022 18:01:33 +0100
Message-ID: <f8600a3b-f697-2577-8fea-f40d3e18bea8@postgresfriends.org> (raw)
In-Reply-To: <4fb63750-6925-d444-b855-17927bd72bc4@dunslane.net>
References: <3bbbb0df-7382-bf87-9737-340ba096e034@postgrespro.ru>
	<3190059.1665164276@sss.pgh.pa.us>
	<57b7cc2e-1215-3f43-84e4-6d9f8ad575df@dunslane.net>
	<CADkLM=djieyppZpKgveeDdt3QYLt+XQGHzpoa+Sd_Lwa5dDTWA@mail.gmail.com>
	<3049337.1669008405@sss.pgh.pa.us>
	<469338a3-da38-160f-23b9-813c261bc1d6@dunslane.net>
	<1677334.1669918475@sss.pgh.pa.us>
	<CA+TgmoY44nbY6Z7zbnQ1VwgDu79DbOHmh4o8K9cBu0OeC2Hndw@mail.gmail.com>
	<1695760.1669923671@sss.pgh.pa.us>
	<CA+TgmobpfOx0WT+ZG71eB5=JrKUi-VX7FwsVF6E8ps1WfKYYcQ@mail.gmail.com>
	<1703871.1669927782@sss.pgh.pa.us>
	<CA+TgmoaxLcxpLmFJ=QiOThfPRGLhRH+o2XZmVie2KOk5TKGbKg@mail.gmail.com>
	<1721519.1669934025@sss.pgh.pa.us>
	<CA+TgmoZ5tQz4sZfXOAK-wx7e2d2+pGg4EEc1TA4sb9gNMjm4Fw@mail.gmail.com>
	<1925585.1669990324@sss.pgh.pa.us>
	<02cf2f81-a776-37ff-291c-100480722a5c@dunslane.net>
	<2503569.1670104001@sss.pgh.pa.us>
	<ecaee1af-437b-9ef1-5140-9da0263f19b2@dunslane.net>
	<2629670.1670167523@sss.pgh.pa.us>
	<4fb63750-6925-d444-b855-17927bd72bc4@dunslane.net>

On 12/4/22 17:21, Andrew Dunstan wrote:
> 
> More generally, I can see uses for error free
> casts, something like, say CAST(foo AS bar ON ERROR blurfl)

What I am proposing for inclusion in the standard is basically the same 
as what JSON does:

<cast specification> ::=
CAST <left paren>
     <cast operand> AS <cast target>
     [ FORMAT <cast template> ]
     [ <cast error behavior> ON ERROR ]
     <right paren>

<cast error behavior> ::=
     ERROR
   | NULL
   | DEFAULT <value expression>

Once/If I get that in, I will be pushing to get that syntax in postgres 
as well.
-- 
Vik Fearing






view thread (175+ messages)  latest in thread

Message-ID: <f8600a3b-f697-2577-8fea-f40d3e18bea8@postgresfriends.org>
Permalink:  ../f8600a3b-f697-2577-8fea-f40d3e18bea8@postgresfriends.org/
Also on:    postgresql.org/message-id/f8600a3b-f697-2577-8fea-f40d3e18bea8@postgresfriends.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: vik@postgresfriends.org, andrew@dunslane.net, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, corey.huinker@gmail.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
  Subject: Re: Error-safe user functions
  In-Reply-To: <f8600a3b-f697-2577-8fea-f40d3e18bea8@postgresfriends.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox