pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Guyren Howe <guyren@gmail.com>
To: Postgres General <pgsql-general@postgresql.org>
Subject: Re: Content for talk on Postgres Type System at PostgresConf
Date: Thu, 29 Feb 2024 14:47:57 -0800
Message-ID: <05C34416-A3DE-42CC-A95E-B1FD268D6574@gmail.com> (raw)
In-Reply-To: <F9A4875C-503C-4D1F-8AA6-0C204F60D3F4@gmail.com>
References: <F9A4875C-503C-4D1F-8AA6-0C204F60D3F4@gmail.com>

On 28 Feb 2024, at 17:08, Guyren Howe <guyren@gmail.com> wrote:
> 
> I am to talk about Postgres’s type system at PGConf:
> 
> https://postgresconf.org/conferences/2024/program/proposals/postgres-s-type-system
> 
> I picked the issue because I think it’s poorly understood, greatly under-discussed, and an excellent way to empower postgres users.
> 
> I am reasonably conversant with the issue. I’m not looking for others to write the talk for me, but in order to make the best talk I can, I’m asking:
> 
> What would you want to see in such a talk?
> 
> I’m planning on covering:
> 
> - The built-in types that are underused and their advantages (eg inet)
> - domains
> - such things as details of arrays including multidimensional arrays
> - user-defined types, their relationship to tables, and generally how to use them
> 
> I would spend most of the time discussing ways to make effective use of types. Some examples:
> - defining functions of rows so the table can be used kind of like a set of objects (including the dot notation for invoking functions)
> - using UDFs to make code clearer eg if you have an idiosyncratic functional index, define it using a function of the row, so it’s easy to get right when querying
> - using UDFs as a kind of better domain. eg differentiating imperial from metric units by requiring an explicit constructor, not just accepting any old number
> 
> I would mention enumerated types, although I’m inclined to advise that their inflexibility (eg can’t delete or rearrange them) means that a related table is probably better (I’d be delighted to be proved wrong).
> 
> Custom Range Types are an interesting feature, but I can’t think of a good use case. Any good examples?
> 
> Automatic casting is a feature I’m aware of, but I’d be interested in any cool use cases.
> 
> 
> Anything I’m missing? Any existing good discussions of the subject?

Any gotchas about user defined types or arrays? I was only planning on discussing simple user defined types, without going into writing the optional features in C.

What is worth saying about custom range types? What even would be a good use case? A range of strings or ip address ranges, something like that, I suppose?

Is there a good case for enumerations versus a fk to a table? I guess if you’re sure you won’t need to change the values in the enumeration? Days of the week, that sort of thing.=

view thread (17+ messages)  latest in thread

Message-ID: <05C34416-A3DE-42CC-A95E-B1FD268D6574@gmail.com>
Permalink:  ../05C34416-A3DE-42CC-A95E-B1FD268D6574@gmail.com/
Also on:    postgresql.org/message-id/05C34416-A3DE-42CC-A95E-B1FD268D6574@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: guyren@gmail.com
  Subject: Re: Content for talk on Postgres Type System at PostgresConf
  In-Reply-To: <05C34416-A3DE-42CC-A95E-B1FD268D6574@gmail.com>
  References: <F9A4875C-503C-4D1F-8AA6-0C204F60D3F4@gmail.com> <05C34416-A3DE-42CC-A95E-B1FD268D6574@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox