Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw1lV-00074g-4L for pgsql-admin@arkaria.postgresql.org; Fri, 09 Aug 2019 10:04:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hw1lT-0003m5-Qe for pgsql-admin@arkaria.postgresql.org; Fri, 09 Aug 2019 10:04:51 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw1lT-0003ly-H6 for pgsql-admin@lists.postgresql.org; Fri, 09 Aug 2019 10:04:51 +0000 Received: from mail-dasl.optinet.hr ([85.114.35.7]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw1lR-0003tz-CC for pgsql-admin@lists.postgresql.org; Fri, 09 Aug 2019 10:04:51 +0000 Received: from [192.168.0.20] (89-201-195-15.dsl.optinet.hr [89.201.195.15]) by mail-dasl.optinet.hr (OptimaMail-adsl1) with SMTP for pgsql-admin@lists.postgresql.org; Fri, 09 Aug 2019 12:04:46 +0200 (CEST) Subject: Re: Problem with schemas, possibly oids? To: pgsql-admin@lists.postgresql.org References: <3cabefc3-0713-7f5d-27c5-c0dab55cd8c6@Bios-ICT.hr> <19010.1565274302@sss.pgh.pa.us> <49e6cc59-5e8f-78c0-389d-f4c48e49f4ab@Bios-ICT.hr> From: Arni Openpgp: preference=signencrypt Autocrypt: addr=Arni.Kromic@Bios-ICT.hr; prefer-encrypt=mutual; keydata= xsFNBFq+khoBEACdC7vnOWflosSNLuIZrzGNh4ADaQbLSGWQVBal0etZB+HZhLK86dKLoMPd ZQdKg3L8hTSj8mnRawDupUoi/CQeWpnhVH9QW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JCGnCExBwARAQABwsF8BBgBCAAmFiEEWsZZVFQn0AyJUBQJffOedavO0IIF Alq+khoCGwwFCQlmAYAACgkQffOedavO0IIjfQ/7Bh5bViTTu6V2MtUkuGX3r5sbWv25PJOJ u2fMLhB/2FfbseP6HmuHcXx7hCPVMYKqClGtKlJJzyyTsQNw7yyfZzR1YFl1gmn6i6kWOQzj RJgEJBF1BybdGvYRW0AnrlsMKJwo9yRi0y/dd6Tqwz70/LrpdjufM5OKKfTBRS97zeY7di4Y G0iZEcCFGS+y0DQn6lT6DsJIQWattI4yKnWss7rJhLYNLa5mZIsyTceT88DicDwZLK7T/bJs LZ5iqqDjb3XQeXxpI654Z3QAjrtQ01Q+oiEZTvyYVbTaIi3UgSnNT1zp58c+lPxxjZgOhZAz 7HCCgtsQlBQW05O1t2D96EekIkKQFoFIB+wgc5EazDpRSZHKe9e+76yqWuNafRGjevNy60UI TTx05+po7kNWxd24C/MUj+otdyALGr1qmPbtbePs4LcOuQr/vhVFG9Kf4swxzx1C+Yc/icRz bblJQJTfGnHI7iQQNxMN7l0HFtlhtnyCk41cTBbM7eCDHxZNyK/Yhw+u74woiSElmhhkpIiW iXvy0/k/XoiKhGY4erYee5dDIY/DFuOv8C1g8snZ/XBEmp3u6tkZXmG5JKC0iJ87Hg623fvU SKjtNgnUGhTCURtzrIPjthErfOcIPaQdpa1h1076+2N6An7uqWnJBR6/ztqQlVP+IGemNP6y 6w0= Organization: BIOS ICT d.o.o. Split Message-ID: <7b555c9d-8d50-eced-53e8-b64bd35b883a@Bios-ICT.hr> Date: Fri, 9 Aug 2019 12:04:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: hr-HR X-OM-Umi: 89.201.195.15:50634:556492 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pozdrav, Arni On 09/08/2019 11.53, Luca Ferrari wrote: > On Fri, Aug 9, 2019 at 11:39 AM Arni wrote: >> On 08/08/2019 16.38, Luca Ferrari wrote: >>> the first query is performed with quote_ident and that's the initial >>> failure. >> Oh now I get it, that was the reason why it wouldn't clone an existing >> schema! My schema names are always quoted and that's why it fails. I >> removed that quote_indent and it sort of works now (even though it still >> fails trying to do something on a nonexistant column!) I wonder how >> nobody noticed this before, while so many people discussed the script. >> As I'm not so good with procedural SQL, I wouldn't have caught it too. >> Many thanks! > I didn't get this: your schema name requires double quotes because it > has uppercase letters, and you fixed it removing quote_ident? > Do you have the time and patient to reproduce every single query done > by the script and see what exactly does not work? Because it seems to > me that the schema is always quote_ident-ed. Always quote_ident-ed... well, yes and no :) The confusion seems to spring from the way quote_ident works! Let me illustrate with two examples: postgres=# select quote_ident('HR0000');  quote_ident -------------  "HR0000" (1 row) postgres=# select quote_ident('hr0000');  quote_ident -------------  hr0000 (1 row) Apparently, postgres thinks the identifier should be quoted if it contains capitals, and not if there are none (or any other characters it finds offensive!) That inevitably leads to different behaviors for different types of identifier names, which may introduce subtle bugs as is the case here. > Luca > > >