Content for talk on Postgres Type System at PostgresConf - Mailing list pgsql-general

From Guyren Howe
Subject Content for talk on Postgres Type System at PostgresConf
Date
Msg-id F9A4875C-503C-4D1F-8AA6-0C204F60D3F4@gmail.com
Whole thread Raw
Responses Re: Content for talk on Postgres Type System at PostgresConf  (Laurenz Albe <laurenz.albe@cybertec.at>)
Re: Content for talk on Postgres Type System at PostgresConf  (Guyren Howe <guyren@gmail.com>)
List pgsql-general
I am to talk about Postgres’s type system at PGConf:


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?

pgsql-general by date:

Previous
From: Erik Wienhold
Date:
Subject: Re: Excel Source [24]] Error: System.Exception: SqlTruncateException: Numeric arithmetic causes
Next
From: Mark Schloss
Date:
Subject: RE: walreceiver fails on asynchronous replica [EXTERNAL] [SEC=UNOFFICIAL]