pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julien Rouhaud <rjuju123@gmail.com>
To: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: SQL-standard function body
Date: Wed, 31 Mar 2021 18:12:56 +0800
Message-ID: <20210331101256.d7h7d74o4celskt4@nol> (raw)
In-Reply-To: <CAJKUy5giffMO31KfBxgSgcaXRC48HfhqwWB6fewAE_8cgOGe2w@mail.gmail.com>
References: <59430371-e1c8-3ee8-7ef6-371eb1a00e7e@2ndquadrant.com>
	<e5996aab-a52c-40ad-543e-2fac3ecf31c3@2ndquadrant.com>
	<4b91051f-c090-532f-42f9-d901f9123f1e@2ndquadrant.com>
	<CAJKUy5i9hGy-uCGjqmG6T=0TjDbS0mw14sOssjiDVMd0aOTG1A@mail.gmail.com>
	<e14f620c-8e10-8103-e12d-657991c9dda7@2ndquadrant.com>
	<CAJKUy5j3N23=SuF=S=xX6mu8VX3N9qSbxiej2wMsAqZ3FB2Pow@mail.gmail.com>
	<20210315080344.wed62yy54fuse7jg@nol>
	<20210315081448.63vagqr3ly45l74i@nol>
	<c17ea953-0837-70ab-b408-522421697d54@2ndquadrant.com>
	<CAJKUy5giffMO31KfBxgSgcaXRC48HfhqwWB6fewAE_8cgOGe2w@mail.gmail.com>

On Tue, Mar 23, 2021 at 11:28:55PM -0500, Jaime Casanova wrote:
> On Fri, Mar 19, 2021 at 8:49 AM Peter Eisentraut
> <peter.eisentraut@2ndquadrant.com> wrote:
> >
> > Right.  Here is a new patch with that fix added and a small conflict
> > resolved.
> 
> Great.
> 
> It seems print_function_sqlbody() is not protected to avoid receiving
> a function that hasn't a standard sql body in
> src/backend/utils/adt/ruleutils.c:3292, but instead it has an assert
> that gets hit with something like this:
> 
> CREATE FUNCTION foo() RETURNS int LANGUAGE SQL AS $$ SELECT 1 $$;
> SELECT pg_get_function_sqlbody('foo'::regproc);

It would also be good to add a regression test checking that we can't define a
function with both a prosrc and a prosqlbody.



@@ -76,6 +77,7 @@ ProcedureCreate(const char *procedureName,
                Oid languageValidator,
                const char *prosrc,
                const char *probin,
+               Node *prosqlbody,
                char prokind,
                bool security_definer,
                bool isLeakProof,
@@ -119,8 +121,6 @@ ProcedureCreate(const char *procedureName,
    /*
     * sanity checks
     */
-   Assert(PointerIsValid(prosrc));
-
    parameterCount = parameterTypes->dim1;


Shouldn't we still assert that we either have a valid procsrc or valid
prosqlbody?

No other comments apart from that!





view thread (90+ messages)  latest in thread

Message-ID: <20210331101256.d7h7d74o4celskt4@nol>
Permalink:  ../20210331101256.d7h7d74o4celskt4@nol/
Also on:    postgresql.org/message-id/20210331101256.d7h7d74o4celskt4@nol

 · 

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: rjuju123@gmail.com, jcasanov@systemguards.com.ec, peter.eisentraut@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: SQL-standard function body
  In-Reply-To: <20210331101256.d7h7d74o4celskt4@nol>

* 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