Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9dGW-0005eE-4Z for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2017 20:36:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9dGV-0007HK-Hl for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Oct 2017 20:36:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e9dEv-0004Ii-JN for pgsql-hackers@postgresql.org; Tue, 31 Oct 2017 20:34:25 +0000 Received: from mail-wr0-x231.google.com ([2a00:1450:400c:c0c::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1e9dEn-0004io-Pm for pgsql-hackers@postgresql.org; Tue, 31 Oct 2017 20:34:24 +0000 Received: by mail-wr0-x231.google.com with SMTP id l1so212370wrc.3 for ; Tue, 31 Oct 2017 13:34:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xjjuvr9AXjALmalJQ2ali83vWxKy1oihfstPW6TryJY=; b=XnglnrwP87xHcRmCJjlff+n/OSWXfWKnhbxYSyOsGsD24BQfM79ZFgWQfoROnhwQ9q 2pqHC8Ocjesdio1bTrq8VDzbHMJMmBACHO/pJiB99fhEEE/eCwcBOutOeve8dKJxLXh5 Y+wqBsMGVRprRZ+TeI5BvilTYQUjjieuw+IcavJ92ZC4krQPzatJ0WUUE2IuRTjnZ682 5zmmc78Jd+oSrcY0tgoNljRzUWFP8HS7Ooukf0Vyli+ya9cm7cUeXPyc1CmDlchMFF/o NtfnE3ewxdRVRiEHhndAKtrXYq3wA/t0m5L2AjRlgKaLjD9dCETyiQQznTs4Op5GuGI9 WN2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xjjuvr9AXjALmalJQ2ali83vWxKy1oihfstPW6TryJY=; b=Rkv5GOo9D+f4xR9Uc6ZdOgNgD1O7BH3xpUPLO2ihxa7yljduVwCGanARGDtb8ygO9s rlhFs7PZNazewTha8do+J5tZZJskQt8iuffhwaRrCyjKyvtbDwbmx4afNP0wEw1c92sv cTqdxFVaV2J0veBevsgsbVnqFpW83JuDRFKyloDxu/HoX7AdzHLzkbIF1Mzs6JmGbcsm g73Q5X9HCjWAKb0wED/hm3fQSsRJJF5MfCrafNESKSE3PQObYGPq63e/O0r1JgTR8yJC gvgdlsTPyAOjc04KcUUrzby7XPtRu/pO50hBfj9cU+IqZ5c7APln0ZYsX0XJdWcEROvb 3itg== X-Gm-Message-State: AMCzsaUNbAxykEBqcuRKmrWTB9YTEYPCjd3LhUscFGJWe/3r6i/3iOzJ 0lz7ad6HGznS2X0asIY/Sq0o9uJiPooH0I17xY8= X-Google-Smtp-Source: ABhQp+TYaBt54lyEkn4Q/UwrwBhAUmtNFOdJ2UZdh6y7H4dPUGavsbfNtwWL8y7vtGJqoLIPOXo7uGCAAHCTVwO5WDc= X-Received: by 10.223.182.80 with SMTP id i16mr3238133wre.110.1509482055792; Tue, 31 Oct 2017 13:34:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.146.7 with HTTP; Tue, 31 Oct 2017 13:33:35 -0700 (PDT) In-Reply-To: <1509399760322-0.post@n3.nabble.com> References: <20171026220732.GI4496@localhost> <1509399760322-0.post@n3.nabble.com> From: Pavel Stehule Date: Tue, 31 Oct 2017 21:33:35 +0100 Message-ID: Subject: Re: proposal: schema variables To: srielau Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="f403043a0ddcbb0650055cddaddd" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --f403043a0ddcbb0650055cddaddd Content-Type: text/plain; charset="UTF-8" Hi 2017-10-30 22:42 GMT+01:00 srielau : > Pavel, > > I wouldn't put in the DROP option. > Or at least not in that form of syntax. > > By convention CREATE persists DDL and makes object definitions visible > across sessions. > DECLARE defines session private objects which cannot collide with other > sessions. > > If you want variables with a short lifetime that get dropped at the end of > the transaction that by definition would imply a session private object. So > it ought to be DECLARE'd. > > As far as I can see PG has been following this practice so far. > I am thinking so there is little bit overlap between DECLARE and CREATE TEMP VARIABLE command. With DECLARE command, you are usually has not any control when variable will be destroyed. For CREATE TEMP xxxx is DROP IF EXISTS, but it should not be used. It should be very similar to our current temporary tables, that are created in session related temp schema. I can imagine, so DECLARE command will be introduced as short cut for CREATE TEMP VARIABLE, but in this moment I would not to open this topic. I afraid of bikeshedding and I hope so CREATE TEMP VAR is anough. Regards Pavel > Cheers > Serge Rielau > Salesforce.com > > > > -- > Sent from: http://www.postgresql-archive.org/PostgreSQL-hackers- > f1928748.html > > > -- > Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-hackers > --f403043a0ddcbb0650055cddaddd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

2017-10-30 22:42 GMT+01:00 srielau <serge@rielau.com>:
Pavel,

I wouldn't put in the DROP option.
Or at least not in that form of syntax.

By convention CREATE persists DDL and makes object definitions visible
across sessions.
DECLARE defines session private objects which cannot collide with other
sessions.

If you want variables with a short lifetime that get dropped at the end of<= br> the transaction that by definition would imply a session private object. So=
it ought to be DECLARE'd.

As far as I can see PG has been following this practice so far.

I am thinking so there is little bit overlap betwe= en DECLARE and CREATE TEMP VARIABLE command. With DECLARE command, you are = usually has not any control when variable will be destroyed. For CREATE TEM= P xxxx is DROP IF EXISTS, but it should not be used.

It should be very similar to our current temporary tables, that are crea= ted in session related temp schema.

I can ima= gine, so DECLARE command will be introduced as short cut for CREATE TEMP VA= RIABLE, but in this moment I would not to open this topic. I afraid of bike= shedding and I hope so CREATE TEMP VAR is anough.

= Regards

Pavel


Cheers
Serge Rielau
Salesforce.com



--
Sent from: http://www.postgresql-a= rchive.org/PostgreSQL-hackers-f1928748.html


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hacker= s

--f403043a0ddcbb0650055cddaddd--