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 1knkC3-0001fs-A7 for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Dec 2020 15:18:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1knkC2-0004RK-00 for pgsql-hackers@arkaria.postgresql.org; Fri, 11 Dec 2020 15:18:50 +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 <9erthalion6@gmail.com>) id 1knkC1-0004RC-Mc for pgsql-hackers@lists.postgresql.org; Fri, 11 Dec 2020 15:18:49 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1knkBv-0000Ge-AC for pgsql-hackers@postgresql.org; Fri, 11 Dec 2020 15:18:48 +0000 Received: by mail-wm1-x333.google.com with SMTP id q75so8917923wme.2 for ; Fri, 11 Dec 2020 07:18:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=bhw6pRy2HrR9o43VE79U48p/5rweC0OhyRFUggN5Axw=; b=K+Zcsw76tgarfaWpCj7FwlFyddqVF8alzPdPHfkYGaQk4PnbDlRrqK8IW+iZNcWHNU bQBex1UqZMzNdJaRlb0RmuLgaJdBCHQ6yZ2PoL/2W+BoSCIu8IWc32/50A0kBxprpWi+ eA2YaxrDRAHqDyuSV9V2iXgCZqXJ0RLo0t8T1dkyBiI5rfUe1CrTMrgY+cxQ+YcpbShI Gmdxj25DUZVLlW+E38hCmkGK4a8UBS0ps9N8UK2wx2ofZ8ILX2PYk/R78UlTXoKt5Wsu 3brPGFDbUzvmiU4HYsG89oV4O6xX0X5DAmrLjMJhNq++0yU7wQTd5EhjNAapNAAdQ2uH sEWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=bhw6pRy2HrR9o43VE79U48p/5rweC0OhyRFUggN5Axw=; b=bFahnCOflNyApgUvqCfHorqyErc33E2LVdKsnUpc19W9prPQ5aRwyxaaqZLZ0yeYbx V8quHOVvrh5f3/73fPAML2yZQW61BHd94XyIVV/3EybeliOfetigHi1RZjsGo4Co5XZ4 QZsZ3Q5LbVmRWecvoZ8xQwOMUDo/Lb6Hlg5ouYIinZGBW9Brry4w0urQjPlwyhG7sGUO a4fWphDN9YhmOqtA5zP5wpCS9DyYP2FeCn3YmiylNRj0roM46UcdNBYWke4VCo8N+QzI mrmRWQtWYM1Z+lVkDJdeskr9Rz8cBVYgtGUdEoklN9fRqeKxmvheIFYweqO9Kt5fDYKr WbWA== X-Gm-Message-State: AOAM532W96LJwV1UYF0AhGOZddDDEWJrkSC4p4Fny5tg/Vx83gUcrKfH PLpSbDFMWgyKinqwEA5JM/U= X-Google-Smtp-Source: ABdhPJzvaCnrFKKnmivIBnynGniOpW9GXAJB6c732cXneLn2vZoDjdtwufzKJgE5cUiOIxLJmjun7Q== X-Received: by 2002:a7b:c088:: with SMTP id r8mr14244669wmh.45.1607699921564; Fri, 11 Dec 2020 07:18:41 -0800 (PST) Received: from localhost (dslb-094-222-016-204.094.222.pools.vodafone-ip.de. [94.222.16.204]) by smtp.gmail.com with ESMTPSA id l1sm15015785wrq.64.2020.12.11.07.18.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Dec 2020 07:18:40 -0800 (PST) Date: Fri, 11 Dec 2020 16:19:57 +0100 From: Dmitry Dolgov <9erthalion6@gmail.com> To: Pavel Stehule Cc: Tom Lane , Andres Freund , Alexander Korotkov , Justin Pryzby , David Steele , Nikita Glukhov , Alvaro Herrera , David Fetter , Thomas Munro , Oleksandr Shulgin , Robert Haas , Michael Paquier , Oleg Bartunov , Peter Eisentraut , PostgreSQL Hackers Subject: Re: [HACKERS] [PATCH] Generic type subscripting Message-ID: <20201211151957.wqlnxdqjwsd7azzd@localhost> References: <20201207212142.wz5tnbk2jsaqzogb@alap3.anarazel.de> <3253106.1607443505@sss.pgh.pa.us> <20201209013003.hj4ealuvwmzvczs2@alap3.anarazel.de> <3459640.1607477907@sss.pgh.pa.us> <3544235.1607482944@sss.pgh.pa.us> <3635350.1607536188@sss.pgh.pa.us> <20201209183704.x5ue5rctdwmhmlmy@localhost> <3674425.1607540422@sss.pgh.pa.us> <3724341.1607551174@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On Wed, Dec 09, 2020 at 04:59:34PM -0500, Tom Lane wrote: > > 0001 adds the ability to attach a subscript handler to an existing > data type with ALTER TYPE. This is clearly going to be necessary > if we want extension types to be able to use this facility. The > only thing that I think might be controversial here is that I did > not add the ability to set pg_type.typelem. While that'd be easy > enough so far as ALTER TYPE is concerned, I'm not sure that we want > to encourage people to change it. The dependency rules mean that > the semantics of typelem aren't something you really want to change > after-the-fact on an existing type. Also, if we did allow it, any > existing SubscriptingRef.refelemtype values in stored views would > fail to be updated. I'm curious what could be the use case for setting pg_type.typelem for subscripting? I don't see this that much controversial, but maybe I'm missing something. > On Thu, Dec 10, 2020 at 05:37:20AM +0100, Pavel Stehule wrote: > st 9. 12. 2020 v 22:59 odesílatel Tom Lane napsal: > > > 0002 makes use of that to support subscripting of hstore. I'm not > > sure how much we care about that from a functionality standpoint, > > but it seems like it might be good to have a contrib module testing > > that extensions can use this. Also, I thought possibly an example > > showing what's basically the minimum possible amount of complexity > > would be good to have. If people like this, I'll finish it up (it > > lacks docs) and add it. > > > > +1 using subscripts for hstore is nice idea Yeah, I also find it's a good suggestion, the implementation seems fine as well. As a side note, I'm surprised hstore doesn't have any functionality to update values, except hstore_concat.