Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhtVa-0007HH-Js for pgsql-general@arkaria.postgresql.org; Fri, 22 Apr 2022 13:39:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nhtVZ-0006BG-G8 for pgsql-general@arkaria.postgresql.org; Fri, 22 Apr 2022 13:39:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhtVZ-0006Aj-5P for pgsql-general@lists.postgresql.org; Fri, 22 Apr 2022 13:39:37 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nhtVW-0000N8-VD for pgsql-general@lists.postgresql.org; Fri, 22 Apr 2022 13:39:36 +0000 Received: by mail-wr1-x436.google.com with SMTP id b19so11080518wrh.11 for ; Fri, 22 Apr 2022 06:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=24rQOjOjVrmlKdQ85klX+GCJ1mZwZUNbSs9YhOYgMO4=; b=t64d2oCPA3MN+8yTVKvzNMGhv0dEcaCzk6aykpkbCLgJr9IE834t38OgHP9EBuOGCU 4nDVqNhOv6t3OUJ0rzP/v5lZHhpSAgrvcmR51QuzPu0K9CkVdRQNN9l+ZKS6w6hj/q2L wXpLe1XHDdm9kFjRcK9B0PJeNUkP5kAMGpKKGiLPDfL5haUe/I68s3CkhHcvgLHaQ/zT ql5uShUBBvEQF27ZPgyQ1JTdRy6PKu8PMaR1Fbu4Wdf801vNoqS7FER+HluL0WSiqm8E 8vDAelUGNn4XFvbVpbspHoYhthVHwlqQhRNWzntouDmhPTDUEf4dXZ/K0+C228ZmSY4f laXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=24rQOjOjVrmlKdQ85klX+GCJ1mZwZUNbSs9YhOYgMO4=; b=2b+0QbhBUCxvSbci/NXTFiovY1LsWGSl862wWwuyKnjZ1qkovDvNtlWWa6Ghn0vy5q aK2pWRMloBd2eCAenwDjetwB5cJHZrmbVxdUgYkaeK6ZijcRiWB9QU8YY/PFm0WqGd7J RaufUkAUcHPkRFtxOSlLlIdM6kVt5DTA/BbjTt7hyWH7JvYTP/bie3C+b9O1GdEhul/+ CUrPqq4IAYGQMgwt9wh1oEvYXf6eVMvi/2r+DXs7gA1eufcPJa4Sl1Vot/VBD6lJotw+ XWgilcLL3TxLHsBdAREK7gF3ok+2lUhv+eG+Qfunmhi5YtSfRLbKx1sekroy8YxBlD87 l65Q== X-Gm-Message-State: AOAM530ALDQ2gktCPiPzqrT71pkXt3sT8tM1haGiIf0mL9uzUhcxt979 JcRHUsCntrux9DAGbcls/DTaqw== X-Google-Smtp-Source: ABdhPJw4FHJpeKaej7dA+sWjrghqZYYVuLXlX8Iy6YOXFQj7Cjlyky1VQwJCg2SAsvWmOcqb2jNp6w== X-Received: by 2002:a05:6000:2a6:b0:20a:7732:1fdc with SMTP id l6-20020a05600002a600b0020a77321fdcmr3987321wry.256.1650634774032; Fri, 22 Apr 2022 06:39:34 -0700 (PDT) Received: from localhost.localdomain (178-190-170-214.adsl.highway.telekom.at. [178.190.170.214]) by smtp.gmail.com with ESMTPSA id y11-20020a056000168b00b0020a919422ccsm2133757wrd.109.2022.04.22.06.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:39:33 -0700 (PDT) Message-ID: Subject: Re: logical replication worker can't find postgis function From: Laurenz Albe To: Willy-Bas Loos Cc: pgsql-general Date: Fri, 22 Apr 2022 15:39:33 +0200 In-Reply-To: References: <8d54fcdc3ea562e2fd1ada68997aa7377bda5187.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-5.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2022-04-22 at 15:26 +0200, Willy-Bas Loos wrote: > On Fri, Apr 22, 2022 at 3:20 PM Laurenz Albe wrote: > > > > The trigger function is bad and dangerous, because it relies on the current setting of "search_path". > > > > You notice that with logical replication, because "search_path" is empty to avoid security problems. > > Thanks a lot! > Do you mean that all trigger functions are bad and dangerous, or just mine? > Do you have any suggestions for an alternative? There is nothing wrong per se with using trigger functions. But, to attempt a generic statement, any function that fails if you change "search_path" is a potential problem. If your application makes sure that "search_path" is always set correctly, the problem is smaller. If highly privileged processes call the function, the problem becomes worse, because the potential damage is bigger. The best way to make sure nothing can happen is to create all functions with a hard-wired "search_path". Then nothing can go wrong. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com