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 1mPSJ6-0005Fo-HH for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Sep 2021 16:26:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mPSJ3-0003Gm-Qa for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Sep 2021 16:26:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mPSJ3-0003Gd-Ec for pgsql-hackers@lists.postgresql.org; Sun, 12 Sep 2021 16:26:13 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mPSIw-0002Oo-PY for pgsql-hackers@lists.postgresql.org; Sun, 12 Sep 2021 16:26:12 +0000 Received: by mail-qv1-xf36.google.com with SMTP id w8so4664964qvt.0 for ; Sun, 12 Sep 2021 09:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=systemguards-com-ec.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Od7tuoSajX0YXUSbGsdAuZI+R4p/o4bYaXmcimcc1D4=; b=MBBdpMw5slS+Cb0uG4pn56rbCyJjumTcFAcIHsfkTRcXzEcRom6a88WE2CsD54KS0v ug5nDgTILMS91/zsHeHYNtl4ShoABBgnSjwUaxKLGjvg3Q8I2+QAY8cV58HzgYgL4BZ7 JJjH1eXtKF/Q9bezmS6nGlBapy9Zs0+sdrM6EUApAKb5clvIVSiZkp28HuIR9JdebTPl CFnatz2xZqdTXv6qBn33y7Syy1h5u/hfuq1mjGBAvRwhQh7DJ4+6pVLghZkY2r1ZrV3w gxy9xvdY+/OVvB2RrjRk7DuwTg2Xq1SR5oeIourVCLlJJi4FCbIWixANyNfNPBQEuQ82 s5RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Od7tuoSajX0YXUSbGsdAuZI+R4p/o4bYaXmcimcc1D4=; b=VTnxuAQa1iZzZdkvsNw9rJ4sSQgiAMw7T3gdmeNjro1s31ZzpC6xxK+T9yCNwfwNOS 6Ji5uIx4pl70DefJ0RYUU3xvllZ0w9bZVEevZuXvNwYAwlkc8vXPI30ke9luCYMsdZXY ZLGeh43yJhw0N2kjmjzaOtCOZ3uYjXpziS3N9JQ255ke2ms2/Z5Ki5VQ2Li/sc4IBKRj T2hU6YnqcE+uY1P5C47GuLDHbEd8Y8c7fNQS1zRUTVzz7PJfP33kwvkFnTvuiDhvdgWZ YmJXpjT6dD8iYx7Frpu4dDMth1mqw2wDj898wEZ9FRC+mD7MuJC1vwVbuwwLu2cjg9GG jTog== X-Gm-Message-State: AOAM533rbBvz1MiNKTPcmDZlB/vLe+zK8kYJjMTGXm7P+7lz4WklBmme zN73Wj6syhskwT16vWC7qODoOg== X-Google-Smtp-Source: ABdhPJxQcGgMQdfFZ/R8+Sv8uAJwv62UbIwKSWn0Oj6MiQLThd5LGxdN1ea2q9uYkToB+NevMBBatg== X-Received: by 2002:a0c:b44f:: with SMTP id e15mr6931480qvf.32.1631463965539; Sun, 12 Sep 2021 09:26:05 -0700 (PDT) Received: from ahch-to ([201.183.0.184]) by smtp.gmail.com with ESMTPSA id 9sm3396212qkc.52.2021.09.12.09.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Sep 2021 09:26:04 -0700 (PDT) Date: Sun, 12 Sep 2021 11:26:00 -0500 From: Jaime Casanova To: Pavel Stehule Cc: Erik Rijkers , Gilles Darold , PostgreSQL Hackers , Michael Paquier , Amit Kapila , Tomas Vondra , Peter Eisentraut , Tom Lane , Alvaro Herrera , Robert Haas Subject: Re: Schema variables - new implementation for Postgres 15 Message-ID: <20210912162600.GA7630@ahch-to> References: <44b94969-5e95-6626-a241-d411c0f8e67d@darold.net> <20210912021338.GA21136@ahch-to> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, Sep 12, 2021 at 05:38:42PM +0200, Pavel Stehule wrote: > Hi > > > """ > > regression=# create temp variable random_number numeric on commit drop; > > CREATE VARIABLE > > regression=# \dV > > Did not find any schema variables. > > regression=# declare q cursor for select 1; > > ERROR: DECLARE CURSOR can only be used in transaction blocks > > """ > > > > I have different result > > postgres=# create temp variable random_number numeric on commit drop; > CREATE VARIABLE > postgres=# \dV > List of variables > ┌────────┬───────────────┬─────────┬─────────────┬────────────┬─────────┬───────┬──────────────────────────┐ > │ Schema │ Name │ Type │ Is nullable │ Is mutable │ Default │ > Owner │ Transactional end action │ > ╞════════╪═══════════════╪═════════╪═════════════╪════════════╪═════════╪═══════╪══════════════════════════╡ > │ public │ random_number │ numeric │ t │ t │ │ > tom2 │ │ > └────────┴───────────────┴─────────┴─────────────┴────────────┴─────────┴───────┴──────────────────────────┘ > (1 row) > > > Hi, Thanks, will test rebased version. BTW, that is not the temp variable. You can note it because of the schema or the lack of a "Transaction end action". That is a normal non-temp variable that has been created before. A TEMP variable with an ON COMMIT DROP created outside an explicit transaction will disappear immediatly like cursor does in the same situation. -- Jaime Casanova Director de Servicios Profesionales SystemGuards - Consultores de PostgreSQL