Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKZl7-0006dQ-GG for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 00:32:37 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dKZl6-00017l-Ij for pgsql-hackers@arkaria.postgresql.org; Tue, 13 Jun 2017 00:32:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dKZl5-00016S-B5 for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 00:32:35 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dKZl1-0004nW-7X for pgsql-hackers@postgresql.org; Tue, 13 Jun 2017 00:32:34 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 834DA208A7; Mon, 12 Jun 2017 20:32:29 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute5.internal (MEProxy); Mon, 12 Jun 2017 20:32:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=1U6a+DdmbRgGXmfUGm ga0LdBP0MF6AnMvdGlqgGispI=; b=Sfti45lY4JCODxgsfWH6Kmy3jkyqjhYmg2 viFH5nSZzmwZvstgeJ9FmMBBPKE2wtc6Dn6l5EUM9Sl1ZUYw6Syqke85kT73zCXg S6gOEWwBHP3v5Ql/71YMqGddkBIALA5eZsGRliQD+cVJKMxV2vI/7U7Ca80Lwa3u PPdCj8Y0sILOdcJGnYheNCAZuIMf+IKzcwJanYvhbamzFlcHMJqeNcWi7Sy6jE7x BgqsCu0nO72h0fv96b20oEJdEbmr8pZqVKyKqVbxbWDgamz5tLaDACmixu3sIveY GR6Rh+J5cvN5f9ZHN5W22FMMZbePRtH3KMz/kB6QSWmCmtq0LLWw== X-ME-Sender: X-Sasl-enc: fE3R1fQo00VPrKoA73NkUi8Fv2rCR4dSzQ+qibKtCFsa 1497313949 Received: from intern.anarazel.de (unknown [208.72.138.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 3E20C7E970; Mon, 12 Jun 2017 20:32:29 -0400 (EDT) Date: Mon, 12 Jun 2017 17:32:28 -0700 From: Andres Freund To: Tom Lane Cc: Mark Dilger , Regina Obe , PostgreSQL-development Subject: Re: PostgreSQL 10 changes in exclusion constraints - did something change? CASE WHEN behavior oddity Message-ID: <20170613003228.2o7plhmcynzaubwz@alap3.anarazel.de> References: <4125B63A-886A-442D-9932-34F0D4F76D41@gmail.com> <20170604193521.ha6d5kpkdswmissm@alap3.anarazel.de> <63850C96-9570-4969-8074-7033DA4C334F@gmail.com> <20170604211942.aiavcbagsho5owcz@alap3.anarazel.de> <13450.1496861842@sss.pgh.pa.us> <25987.1496977553@sss.pgh.pa.us> <20170609032619.crv3skkf7tvzj63j@alap3.anarazel.de> <27103.1496979469@sss.pgh.pa.us> <5259.1497044025@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5259.1497044025@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2017-06-09 17:33:45 -0400, Tom Lane wrote: > diff --git a/src/backend/catalog/information_schema.sql b/src/backend/catalog/information_schema.sql > index cbcd6cf..98bcfa0 100644 > --- a/src/backend/catalog/information_schema.sql > +++ b/src/backend/catalog/information_schema.sql > @@ -2936,12 +2936,14 @@ CREATE VIEW user_mapping_options AS > SELECT authorization_identifier, > foreign_server_catalog, > foreign_server_name, > - CAST((pg_options_to_table(um.umoptions)).option_name AS sql_identifier) AS option_name, > + CAST(opts.option_name AS sql_identifier) AS option_name, > CAST(CASE WHEN (umuser <> 0 AND authorization_identifier = current_user) > OR (umuser = 0 AND pg_has_role(srvowner, 'USAGE')) > - OR (SELECT rolsuper FROM pg_authid WHERE rolname = current_user) THEN (pg_options_to_table(um.umoptions)).option_value > + OR (SELECT rolsuper FROM pg_authid WHERE rolname = current_user) > + THEN opts.option_value > ELSE NULL END AS character_data) AS option_value > - FROM _pg_user_mappings um; > + FROM _pg_user_mappings um, > + pg_options_to_table(um.umoptions) opts; This really is a lot better... > GRANT SELECT ON user_mapping_options TO PUBLIC; > > diff --git a/src/backend/executor/functions.c b/sindex a35ba32..89aea2f 100644 > --- a/src/backend/executor/functions.c > +++ b/src/backend/executor/functions.c > @@ -388,6 +388,7 @@ sql_fn_post_column_ref(ParseState *pstat > param = ParseFuncOrColumn(pstate, > list_make1(subfield), > list_make1(param), > + pstate->p_last_srf, > NULL, > cref->location); > } > diff --git a/src/backend/parser/parse_aindex efe1c37..5241fd2 100644 > --- a/src/backend/parser/parse_agg.c > +++ b/src/backend/parser/parse_agg.c > @@ -705,6 +705,13 @@ check_agg_arguments_walker(Node *node, > } > /* Continue and descend into subtree */ > } > + /* We can throw error on sight for a set-returning function */ > + if ((IsA(node, FuncExpr) &&((FuncExpr *) node)->funcretset) || > + (IsA(node, OpExpr) &&((OpExpr *) node)->opretset)) > + ereport(ERROR, > + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), > + errmsg("aggregate function calls cannot contain set-returning function calls"), > + parser_errposition(context->pstate, exprLocation(node)))); Possibly too hard to be precise enough in a hint, but a number of these could benefit from one suggesting moving things into FROM, using LATERAL. I'm kinda positively surprised at how non-invasive this turned out, I'd afraid there'd be a lot more verbosity to it. I think the improved error messages (message & location), are quite worthwhile an their own. Greetings, Andres Freund -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers