Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u8IOz-000S53-SE for pgsql-general@arkaria.postgresql.org; Fri, 25 Apr 2025 12:43:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u8IOv-00AOnM-Vy for pgsql-general@arkaria.postgresql.org; Fri, 25 Apr 2025 12:43:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u8IOv-00AOmx-Jl for pgsql-general@lists.postgresql.org; Fri, 25 Apr 2025 12:43:30 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1u8IOr-0020JG-10 for pgsql-general@lists.postgresql.org; Fri, 25 Apr 2025 12:43:28 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-43d0c18e84eso10492175e9.3 for ; Fri, 25 Apr 2025 05:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1745585005; x=1746189805; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=A9VGZwXN5n+hTRibi/PwsZGLn8H9jJeTc4vn1lTPItQ=; b=sBM8pcAM5PCprWuBf70sF6T3Arh4tlut1tN0lCfGyxaTeUc2Ic37TBrto4IVYWk7+V Be3n9HtfAsYsa4RbGzIsP0/Jt+ptOe6UDx0sswcYfsxtg163AbdsaGN6hMyEn/wbmAEn aTP26GkAqqf50s7V57OKqkbf+5lrppBWhGuygT5QKsHyw/zSq1/7e7G1uxEz3PZZ6Egb 7uRWRdfulhYYLHu/Uv9D6XNZy9CiB5aKBIij4gRUdtD2xYuQDJhv3YrGbkzi7hwRpob8 vn427c26DLFvSZytBg0hC/f6AB9rLxN772I38x9EIGaM+Wa7ir+vJg8gNKkvcIZwMVAI IuJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745585005; x=1746189805; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=A9VGZwXN5n+hTRibi/PwsZGLn8H9jJeTc4vn1lTPItQ=; b=U8gACd8RBouQ8u4QVByqayMkDUIFB6hCuDUPyby9sbmVl/x56VqhGMWUMxz27KfR6H svkOCVRLpvDUrLG3pGBaCdp7/Q/Dcsagom3Z+FeZUJi5JBFa3MqCDCm69ez/8rLJwMOh raab8Fqe+s01qoHSf9xvllssZjgpdCZh2mUIKrEjy7CcgvwY3HPtfmaCDRlE368c7gZD WHCyKIP2+bqMZNnLnwktUbEy9ghMD2SVrNGfBGAJhWSrAweURZhC8lMD/RFH1QankGWq uH3rTY8zkXpBCLEsoBLuVtGAt3SFfVJEBONXF2wJ0T12uvAp3+r21krD/HlvGHQdpvmU eJaA== X-Forwarded-Encrypted: i=1; AJvYcCUrchXo3BvRsxWRv/nC+uJD21ebJk4Eab4aNFpGFjfNSOWJD6p851MR5zX5PgYYBbu+cONleNBIQOC32PeI@lists.postgresql.org X-Gm-Message-State: AOJu0YywQV9PM/uZEBjd6UTWkmpHM6+ZpdlJ7UYhidV7ojKka0/i4X1i kvUPzHsY+AHR4UF8GvyIbS8n8yqRahoNUZcZLnJDYw/HmLj6oSw1B2whOeK+edX3I6ZOhuC5Lpg G X-Gm-Gg: ASbGncv5lhhlG1VRrKBF11Do6hZjhKYcvqrJ9J/YN6q9vErMirXMgLnAgI/2ZUrBNcD RQIyd12BZNt478/TXQlaD538mLCKv2Lmw9ZRtRTMAy4SrFfTvpy8+bHtZV0j8/EPg8t35ygXUAG ehOfTkmYd4lyLhAmQMIxl0sGB0IaqSA7DdL38tSKaraRpjSyNR/qjGDrEU0EpDu4ctNkpSTwEFC mCPRgkwpwgy3D1gkTDy67slsdBP/bCBm+kr40TfIuIMuIpjHyIyNf+Up0+QzmjvsQ1nWZw7L3IQ ly/Rb/qDSKEQRChzw9pWfR44BweYxP6bjBsS2de2aamWnYEtqHKVrbv9Z71S661GfS4CdsY= X-Google-Smtp-Source: AGHT+IFZSPEE9skJZ84YY85zPSMy+Q2plW8jlkCwl9EeBEHBxT7Eg9XEfJHnpquoHm/KhkE2gVpNug== X-Received: by 2002:a05:6000:144b:b0:390:fb37:1bd with SMTP id ffacd0b85a97d-3a074f1571fmr2010690f8f.46.1745585005102; Fri, 25 Apr 2025 05:43:25 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:6a6c:d491:dd1e:ee4f:cc72]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a073ca557bsm2299727f8f.35.2025.04.25.05.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Apr 2025 05:43:24 -0700 (PDT) Message-ID: <88804c921b425d37a3072b5698b558a763d80d63.camel@cybertec.at> Subject: Re: Clarification on RLS policy From: Laurenz Albe To: Vydehi Ganti , pgsql-general@lists.postgresql.org Date: Fri, 25 Apr 2025 14:43:22 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.3 (3.54.3-1.fc41) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2025-04-25 at 12:38 +0530, Vydehi Ganti wrote: > We are presently using Postgresql:PostgreSQL 15.12 on x86_64-pc-linux-gnu= , compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-23), 64-bit > I have a scenario where > 1.I need to enforce RLS policy on a table for Select by calling a Functio= n > 2.The function would return a character varying string which should be ap= pended > to the select as a filter. > Ex: Select * from employee would=C2=A0be appended=C2=A0with where 1=3D1; > 3.When we try to implement it says the below error. > ERROR: invalid input syntax for type boolean: "1=3D1" CONTEXT: PL/pgSQL= function function name(name,name) while casting return value to function's= return type > 4.It works fine on Oracle. Can you please suggest how to fix this issue? You cannot add whole WHERE conditions to a query dynamically. The only way to fix that is to solve the problem differently. Since you didn't tell us details, we cannot tell you how. Yours, Laurenz Albe