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 1rgZu1-006sgv-0d for pgsql-general@arkaria.postgresql.org; Sun, 03 Mar 2024 00:40:29 +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 1rgZtz-0004MR-Dj for pgsql-general@arkaria.postgresql.org; Sun, 03 Mar 2024 00:40:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rgZtz-0004MI-37 for pgsql-general@lists.postgresql.org; Sun, 03 Mar 2024 00:40:27 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rgZtv-002Z1U-AI for pgsql-general@postgresql.org; Sun, 03 Mar 2024 00:40:26 +0000 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-36523b9fa11so14741495ab.3 for ; Sat, 02 Mar 2024 16:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709426422; x=1710031222; darn=postgresql.org; h=mime-version:subject:message-id:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=InS00OrQzK8YAkR2JCA18mvg2bmofMKMvXd726zA3cs=; b=fqJlm+wR987Pr0hrODIqjn1EIFpJi3vmUp74kbeQkw+JnbjAmx4hLi2HnFhmJCXjAl USLseaXdAN+VP3R4VpsHC6xoW5G1YcNSmV/E8keS74KG5zs985aVM93K2fov5sKogPC5 Jig8pYuLjVFEVWrnsfyB052D3NAbIJci98K+IOSJ46tUPRsoYB6+sMnBWOF6MDGzLEL0 iu6ms7xf+5grD8cPzMoPmgl64dLAcsXupLB93L5dR+a1Wyl7kCuQhz1hpggkXD7auidy KhfHH2L2qfAdbKwzWfxHL1Zg/C7aXzwLPa7QBZV+As/scq0NSMhSstNQij4ZPvghwPWW vQEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709426422; x=1710031222; h=mime-version:subject:message-id:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=InS00OrQzK8YAkR2JCA18mvg2bmofMKMvXd726zA3cs=; b=qPpgBykE2ELqyIxBnsjd5MVSiTcQQ+yQcc6mxKXAWzn/Kq93mLnIACAzC6Z6hFH53M KxsQJ9oEYn0FUU0vFCfzUsVfoV6p5V5G2+DHMT3c1dq6e/8YKl3iphOJXCt7R8gp9znA DGq4j7nfR4jX0Hn/kd01+BBnokY2jnIz04tIrkYDncsl/b7yl+R52/C4hdCe/3wsDB7B BggcPgOI4vVq8G+9/LTymNqkq/31+WFeFUrtZTbizryyfjFpRx/dii+Y/Ig3fsPqmwtX QgGF5x6FDbqI4YBrWa+s8qHb4HFS6vs3daOFhQF2JjzJMv9+Bjo4JZFHBaIh69b5ehlt TRRg== X-Gm-Message-State: AOJu0Yy9LOblDRDqRjdvU2jeOpARWj9mYsvNA5oIP4c4jiGyoBk8B/GD CYU1m5oFJt/f6R3IDjCByE8uNnZrjJrCG15Unxb51DoNwT+ummU49o2hW3D7 X-Google-Smtp-Source: AGHT+IEgmQ9N72BPdSlgDVf5QMEfcrHr4uFnTxQI0dw9FNhp7mpsBUZHk1sRy2294FP87fl6uNN5iQ== X-Received: by 2002:a05:6e02:12c3:b0:365:b574:960b with SMTP id i3-20020a056e0212c300b00365b574960bmr6854720ilm.18.1709426421873; Sat, 02 Mar 2024 16:40:21 -0800 (PST) Received: from [2600:8801:8600:631:da:b947:100:0] ([2600:8801:8600:631::e]) by smtp.gmail.com with ESMTPSA id z3-20020a170902708300b001dcc0d06959sm5753939plk.245.2024.03.02.16.40.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Mar 2024 16:40:21 -0800 (PST) Date: Sat, 2 Mar 2024 16:40:06 -0800 From: Guyren Howe To: PG-General Mailing List Message-ID: <506dd5f4-65fe-4d34-8cfe-2ebc08b978e4@Spark> Subject: Thoughts on user-defined types for talk at Postgres conference? X-Readdle-Message-ID: 506dd5f4-65fe-4d34-8cfe-2ebc08b978e4@Spark MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="65e3c6f3_2a9c5dab_2b6" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --65e3c6f3_2a9c5dab_2b6 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I am doing a talk at Postgres Conf about Postgres=E2=80=99s type system. = I already asked about this and got some great responses: https://www.postgresql.org/message-id/flat/b82f8886db61a3395e6eab94981258= 274cdbacd3.camel%40cybertec.at=23f13288b72bd2d564ee758c1a273652ad Those responses discussed mostly gotchas with built-in types. Lots of goo= d stuff, thanks, all=21 But what *really* sets Postgres apart from comparable systems is user def= ined types. I would like to carefully lay out how to define and use a use= r-defined type (I don=E2=80=99t think I have time to dig into doing fancy= stuff with C functions, so just the basic =E2=80=9Cuser defined sum type= =E2=80=9D), but also any gotchas. And I=E2=80=99d like to finish with some thoughts about when and how to u= se user-defined types. My feeling is that this feature is greatly under-u= sed, mostly because it=E2=80=99s so non-standard. But A=46AICT, user-defi= ned types are fine and other than some ugliness due to SQL (mainly needin= g parentheses in some unexpected places), fields in a user defined type w= ork perfectly well in Postgres=E2=80=99s SQL. I guess you=E2=80=99d need = to pull them apart for values returned to clients, but that isn=E2=80=99t= difficult. So, any gotchas with user defined types=3F Any thoughts about designing w= ith them=3F --65e3c6f3_2a9c5dab_2b6 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
I am doing a talk at Postgres Conf about Postgres=E2= =80=99s type system. I already asked about this and got some great respon= ses:&=23160;

https://www.postgresql.org/message-id/fl= at/b82f8886db61a3395e6eab94981258274cdbacd3.camel%40cybertec.at=23f13288b= 72bd2d564ee758c1a273652ad

Those responses discussed mostly gotchas with built-in types. Lots of goo= d stuff, thanks, all=21

But what *really* sets Postgres apart from comparable systems is user def= ined types. I would like to carefully lay out how to define and use a use= r-defined type (I don=E2=80=99t think I have time to dig into doing fancy= stuff with C functions, so just the basic =E2=80=9Cuser defined sum type= =E2=80=9D), but also any gotchas.

And I=E2=80=99d like to finish with some thoughts about when and how to u= se user-defined types. My feeling is that this feature is greatly under-u= sed, mostly because it=E2=80=99s so non-standard. But A=46AICT, user-defi= ned types are fine and other than some ugliness due to SQL (mainly needin= g parentheses in some unexpected places), fields in a user defined type w= ork perfectly well in Postgres=E2=80=99s SQL. I guess you=E2=80=99d need = to pull them apart for values returned to clients, but that isn=E2=80=99t= difficult.

So, any gotchas with user defined types=3F Any thoughts about designing w= ith them=3F
--65e3c6f3_2a9c5dab_2b6--