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 1puBdm-0006WL-OR for pgsql-general@arkaria.postgresql.org; Wed, 03 May 2023 12:31:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1puBdl-0004Vm-Jh for pgsql-general@arkaria.postgresql.org; Wed, 03 May 2023 12:31:25 +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 1puBdl-0004Vb-7n for pgsql-general@lists.postgresql.org; Wed, 03 May 2023 12:31:25 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1puBdd-000LJw-Tx for pgsql-general@lists.postgresql.org; Wed, 03 May 2023 12:31:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=bl/vOXDEM9882SjXVpaY8IbAxYrf3mQzdUfU6/avPSw=; b=u1gKtqwQuiefvOYg7x3Mp6Vtsn ZIHWEsCD5yx1d/aNgHLs5KfWIEg3hvy5N+0rQchlErNOpVpgCqlYdr0JMrDP0ZaWNnUnboP49170J C8rn8+scDYR7+SUwnxMAinL9U3Hjt+jW7QaSAZm5pGdbuRduTRXC9vnqAkreadXKR5zw=; Received: from depesz by depesz.com with local (Exim 4.94.2) (envelope-from ) id 1puBdc-0007QC-F6; Wed, 03 May 2023 14:31:16 +0200 Date: Wed, 3 May 2023 14:31:16 +0200 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: "J.A." Cc: pgsql-general@lists.postgresql.org Subject: Re: PL/pgSQL doesn't support variables in queries? Message-ID: Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, May 03, 2023 at 10:25:55PM +1000, J.A. wrote: > Heya folks :) > > ms-sql person here migrating over to pgsql. One of the first thing's I > noticed with pgsql (or more specifically, PL/pgSQL) is that it doesn't > support "variables" in a query? > > for example, here's some T-SQL: > > DECLARE @fkId INTEGER Sure it does. There is nothing relating to "@" character, though. You can easily find examples in docs: https://www.postgresql.org/docs/current/plpgsql-structure.html depesz