Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cLa8l-00044M-WD for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Dec 2016 18:36:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cLa8k-0002SJ-Ge for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Dec 2016 18:36:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cLa8j-0002S3-H2 for pgsql-hackers@postgresql.org; Mon, 26 Dec 2016 18:36:53 +0000 Received: from mail-qt0-x236.google.com ([2607:f8b0:400d:c0d::236]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cLa8g-0007c7-Qt for pgsql-hackers@postgresql.org; Mon, 26 Dec 2016 18:36:52 +0000 Received: by mail-qt0-x236.google.com with SMTP id c47so313033699qtc.2 for ; Mon, 26 Dec 2016 10:36:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=rQDQ7DOTwWu8kPE5SFL3ohe39gGe2vs7wpIs5xfnmtc=; b=Btnt5yJdaAlrdxp9BAO85j7aU0bygPVkOO7Lw/ZzbkcC4lDW6Y+OO73W4eOhvN/+3f /acXSvCvsadb4p1E8mv5YJCvi3H+PC1bBa6A+hAVOXyaiRdZ+T+svwwl+jrxhZ2gwJEm b18bZLnS7bvPntpbR4u7jVvSvWqdjsIV8qaKU4nrfkZLPRLfW+xGymDDa3kZyPSPXJ0e CCZmX2swHopzlXNl68a5YBSJA4Tgk/O18zwe1lUX0/hwJoDaIGYI45ga22AoOD0Lmk6w wi3Ar0YMJdQi7SL8HptauUpPqbiD133JJoIPVjCFmVMYP2C6//i9peIrCkc579URvPOS xbGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=rQDQ7DOTwWu8kPE5SFL3ohe39gGe2vs7wpIs5xfnmtc=; b=Grmqq5MrgZojBY3Ix40wZWWib+C5uoj2wjqdqGpUJAToDFTJL6/PEcd8dmqLn6ato2 8RwfrZszRIkVw8d2EQw7bJF52p8u/meulJSxpKFpOZK9kMBvAl2S5W8FH8n0ghrIw60+ t6PNy1+PbZSpKxzAYzDfwjvYZJA0fAhegvXNpFIe4pQkNu+B88dYeht13i5U71/L868U 1cL2+0jQIouDzhsccqzWSZ2TKWTGtOnMem5MRGcqfsJtRffkfKuIjpzYLfbkyxflFpX2 gdkN7sBQOJKGZKeOrmdCvBSSWHhaOhbc/BwY0DGosrYCriVkGkoOj5OjBkAVL/k4ftbi ZFig== X-Gm-Message-State: AIkVDXLXRbSGevyoYE3/AaVq4uJ9Z0scO+lJKCr3tt8rWPHrVXieuTinXLbBMX8DH1U/l84/ X-Received: by 10.200.36.46 with SMTP id c43mr25639578qtc.260.1482777409453; Mon, 26 Dec 2016 10:36:49 -0800 (PST) Received: from alvin.alvh.no-ip.org ([179.56.97.120]) by smtp.gmail.com with ESMTPSA id r8sm26797615qtc.32.2016.12.26.10.36.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Dec 2016 10:36:48 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 50D1F1734; Mon, 26 Dec 2016 15:36:47 -0300 (CLST) Date: Mon, 26 Dec 2016 15:36:47 -0300 From: Alvaro Herrera To: Tom Lane Cc: Michael Paquier , Joe Conway , PostgreSQL mailing lists Subject: Re: Incautious handling of overlength identifiers Message-ID: <20161226183647.hjlzi2vqyqvyevsa@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7096.1482773527@sss.pgh.pa.us> User-Agent: NeoMutt/20161104 (1.7.1) X-Pg-Spam-Score: -2.6 (--) 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 Tom Lane wrote: > I wrote: > > Another idea worth considering is to just make the low-level functions > > do truncation ... > > After further thought, there's a bigger-picture issue here, which > is whether the inputs to the SQL functions in question are intended to > be raw user input --- in which case, not only would truncation be > an appropriate service, but probably so would downcasing --- or whether > they are more likely to be coming from a catalog scan, in which case > you don't want any of that stuff. Nobody's going to be happy if we > start making them add quote_ident() around references to name columns. > I think the privilege-inquiry functions are almost certainly mostly > used in the latter style; there might be more room for debate about, > say, pg_get_serial_sequence. I expect that uses of pg_get_object_address() (one of the affected interfaces) would mostly be through an event trigger or a similar internal mechanism, that hopefully should appropriately quote names and not produce anything overlength. At least, pg_identify_object() (which is what I mostly had in mind) complies. I think removing the assert is a good enough solution, myself. I also admit it didn't occur to me to test the function(s) against overlength input when developing it. I wouldn't object to adding code to deal with overlength identifies, but I'm not really sure I would choose truncation over reporting an error. But whatever it'd be, it'd be at that level, not at the lower (hash function) level. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers