pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Andreas Seltenreich <seltenreich@gmx.de>
Cc: Piotr Stefaniak <postgres@piotr-stefaniak.me>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: [sqlsmith] Failed assertion in joinrels.c
Date: Wed, 07 Sep 2016 16:53:34 -0400
Message-ID: <31473.1473281614@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFiTN-se5XgSTehYv2UM2GqxT8aaS+vsGUKiZ9gpfhzvHjsRjQ@mail.gmail.com>
References: <87wpxfygg9.fsf@credativ.de>
	<15630.1438391483@sss.pgh.pa.us>
	<87614zxroq.fsf@credativ.de>
	<2086.1438444757@sss.pgh.pa.us>
	<BLU436-SMTP121548815908D3CF56F631BF2880@phx.gbl>
	<13027.1438546710@sss.pgh.pa.us>
	<87egjhv9j8.fsf@credativ.de>
	<8205.1438906901@sss.pgh.pa.us>
	<CAB7nPqThJsGnH2JNyHPZmXFk8a26RhqRhR7in0zCpT+OttfzEw@mail.gmail.com>
	<14249.1465054181@sss.pgh.pa.us>
	<CAB7nPqRhSh1RrYRnGnk_5DZP8WoKNMuYeL4ed3LEmgQjpZHfpg@mail.gmail.com>
	<CAB7nPqTfzOVgdSK3jKM2L1Awy9nV6RQQni09f8cHjtny6jeQOw@mail.gmail.com>
	<24118.1465136174@sss.pgh.pa.us>
	<CAB7nPqTxF5dtxjEzB7xkJvOWxX8D_2atxmTu3PSnkhcWT_JY5A@mail.gmail.com>
	<CA+TgmoZ6rtR0ozn41GB63m1QitKUP45Z9dA3w4apbeHwq8SwYA@mail.gmail.com>
	<CAB7nPqSW-rUBUaECXzi1ZNMpNLdEsDYec=2mWNQ+J4qeGKF2OQ@mail.gmail.com>
	<CA+Tgmoah9DyjU-SNL+S6H5MX92dfmS4aQTj3bBq+uoKyN2mAgA@mail.gmail.com>
	<15728.1469809063@sss.pgh.pa.us>
	<CAB7nPqT1WVHuCVpM+ppKzpz5cf63hSomz4xH9St9g8NwE862VQ@mail.gmail.com>
	<CA+TgmoYWEeF2R83eA9-D4XWaK1nUSDg3Tu-bj2WHUA2g=9sKVA@mail.g! mail.com>
	<11796.1470179775@sss.pgh.pa.us>
	<CA+TgmoY3Fcuh0+_yn-dZza2_Revcz-46-m7Ozcu4Af-Fs_9dtA@mail.gmail.com>
	<CAFiTN-vdw-xXBufNETj=CFbJgZE1uQ86c8eDJy==UY8HWNJM1A@mail.gmail.com>
	<CAA4eK1JvwAeDV5GPxZZrtckh0mMadd0-tL7ZE9bMwwZPwz3aGQ@mail.gmail.com>
	<CAA4eK1JrgbBVHj2g2F-Qh9zsZViampD-2WX0A6epBE7c52f-_A@mail.gmail.com>
	<CAFiTN-uRXwc51ywPKTLhK1Jtz6JzwmAPXKMK11pivj7o85_x5A@mail.gmail.com>
	<CAA4eK1Js5kr4EZFCwYWtXpvvR1-65xTUuLueV-yH04Faq-oAgQ@mail.gmail.com>
	<CAFiTN-uOcV78Nk46YL4n+V4Hw8cGyZyDc6LnE335UKTS46VwdA@mail.gmail.com>
	<CAFiTN-uDzLQDEUxVzZWxvCtSM0rXdnzw8it99-vMmnPnebn+9Q@mail.gmail.com>
	<CAA4eK1+hZf=MLkbZsZFjf3OLL4JUVsDj+aSNfj4_ci5+TDEKrg@mail.gmail.com>
	<CA+TgmobCYZKTzMBa2DHEvmbYP_H2wnrQ7NTH0=DapO7c5jLN8g@mail.gmail.com>
	<CAFiTN-se5XgSTehYv2UM2GqxT8aaS+vsGUKiZ9gpfhzvHjsRjQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Dilip Kumar <dilipbalaut@gmail.com> writes:
> Basically this patch changes error at three places.

> 1. getBaseTypeAndTypmod: This is being called from domain_in exposed
> function (domain_in->
> domain_state_setup-> getBaseTypeAndTypmod). Though this function is
> being called from many other places which are not exposed function,
> but I don't this will have any imapct, will this ?

I really don't like this solution.  Changing this one function, out of the
dozens just like it in lsyscache.c, seems utterly random and arbitrary.

I'm actually not especially convinced that passing domain_in a random
OID needs to not produce an XX000 error.  That isn't a user-facing
function and people shouldn't be calling it by hand at all.  The same
goes for record_in.  But if we do want those cases to avoid this,
I think it's appropriate to fix it in those functions, not decree
that essentially-random other parts of the system should bear the
responsibility.  (Thought experiment: if we changed the order of
operations in domain_in so that getBaseTypeAndTypmod were no longer
the first place to fail, would we undo this change and then change
wherever the failure had moved to?  That's pretty messy.)

In the case of record_in, it seems like it'd be easy enough to use
lookup_rowtype_tupdesc_noerror() instead of lookup_rowtype_tupdesc()
and then throw a user-facing error right there.  Not sure about a
nice solution for domain_in.  We might have to resort to an extra
syscache lookup there, but even if we did, it should happen only
once per query so that's not very awful.

> 3. CheckFunctionValidatorAccess: This is being called from all
> language validator functions.

This part seems reasonable, since the validator functions are documented
as something users might call, and CheckFunctionValidatorAccess seems
like an apropos place to handle it.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (55+ messages)  latest in thread

Message-ID: <31473.1473281614@sss.pgh.pa.us>
Permalink:  ../31473.1473281614@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/31473.1473281614@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dilipbalaut@gmail.com, robertmhaas@gmail.com, amit.kapila16@gmail.com, michael.paquier@gmail.com, seltenreich@gmx.de, postgres@piotr-stefaniak.me
  Subject: Re: [sqlsmith] Failed assertion in joinrels.c
  In-Reply-To: <31473.1473281614@sss.pgh.pa.us>
  References: <87wpxfygg9.fsf@credativ.de> <15728.1469809063@sss.pgh.pa.us> <CAB7nPqT1WVHuCVpM+ppKzpz5cf63hSomz4xH9St9g8NwE862VQ@mail.gmail.com> <11796.1470179775@sss.pgh.pa.us> <CA+TgmoY3Fcuh0+_yn-dZza2_Revcz-46-m7Ozcu4Af-Fs_9dtA@mail.gmail.com> <CAFiTN-vdw-xXBufNETj=CFbJgZE1uQ86c8eDJy==UY8HWNJM1A@mail.gmail.com> <CAA4eK1JvwAeDV5GPxZZrtckh0mMadd0-tL7ZE9bMwwZPwz3aGQ@mail.gmail.com> <CAA4eK1JrgbBVHj2g2F-Qh9zsZViampD-2WX0A6epBE7c52f-_A@mail.gmail.com> <CAFiTN-uRXwc51ywPKTLhK1Jtz6JzwmAPXKMK11pivj7o85_x5A@mail.gmail.com> <CAA4eK1Js5kr4EZFCwYWtXpvvR1-65xTUuLueV-yH04Faq-oAgQ@mail.gmail.com> <CAFiTN-uOcV78Nk46YL4n+V4Hw8cGyZyDc6LnE335UKTS46VwdA@mail.gmail.com> <CAFiTN-uDzLQDEUxVzZWxvCtSM0rXdnzw8it99-vMmnPnebn+9Q@mail.gmail.com> <CAA4eK1+hZf=MLkbZsZFjf3OLL4JUVsDj+aSNfj4_ci5+TDEKrg@mail.gmail.com> <CA+TgmobCYZKTzMBa2DHEvmbYP_H2wnrQ7NTH0=DapO7c5jLN8g@mail.gmail.com> <CAFiTN-se5XgSTehYv2UM2GqxT8aaS+vsGUKiZ9gpfhzvHjsRjQ@mail.gmail.com> <31473.1473281614@sss.pgh.pa.us>

* 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