pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Jaime Casanova <jaime.casanova@2ndquadrant.com>
Subject: Re: [HACKERS] generated columns
Date: Thu, 22 Nov 2018 16:16:34 +0100
Message-ID: <af76601d-5483-d718-dda4-6222080caa21@2ndquadrant.com> (raw)
In-Reply-To: <CA+TgmoZ=LWpzn0S2NXBJhL+y8Bq1pF8gjrusTHF2acDjcnTb9w@mail.gmail.com>
References: <b151f851-4019-bdb1-699e-ebab07d2f40a@2ndquadrant.com>
	<CAJGNTeOxeQPFpEr35PME4yLayRzP_wwzt70kFrPztSTWHf-HDA@mail.gmail.com>
	<CAJGNTeM+MCjA4dBhAdjJ-vR_CwY3u65cCcc+KvnahzLHZjxjbw@mail.gmail.com>
	<1bc948f8-3bab-6c54-50af-c0723a75b85f@2ndquadrant.com>
	<20180116063546.GA3679@paquier.xyz>
	<48502d9b-60c4-5b10-40a2-e34f562132b4@2ndquadrant.com>
	<20180119051804.GC12826@paquier.xyz>
	<2e3d5147-16f8-af0f-00ab-4c72cafc896f@2ndquadrant.com>
	<20180131131804.GB1586@paquier.xyz>
	<bf9c8765-1aa0-432a-442e-45f715ebe4e7@2ndquadrant.com>
	<20180202022532.GA84623@paquier.xyz>
	<050e663d-d915-f61b-af96-5a09c10ade02@2ndquadrant.com>
	<79e4de23-52e3-2c45-9ba0-5f6932f590aa@2ndquadrant.com>
	<CA+TgmoZ=LWpzn0S2NXBJhL+y8Bq1pF8gjrusTHF2acDjcnTb9w@mail.gmail.com>

On 15/11/2018 15:10, Robert Haas wrote:
> I don't have a strong position on 1 vs. 2 vs. 3, but I do think it
> would be nicer not to use '\0' as a column value.  I'd suggest you use
> 'n' or '0' or '-' or some other printable character instead.

I had carefully considered this when attidentity was added.  Using '\0'
allows you to use this column as a boolean in C code, which is often
convenient.  Also, there are numerous places where a pg_attribute form
or a tuple descriptor is initialized to all zeroes, which works well for
most fields, and adding one exception like this would create a lot of
extra work and bloat the patch and create potential for future
instability.  Also note that a C char '\0' is represented as '' (empty
string) in SQL, so this also creates a natural representation in SQL.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (112+ messages)  latest in thread

Message-ID: <af76601d-5483-d718-dda4-6222080caa21@2ndquadrant.com>
Permalink:  ../af76601d-5483-d718-dda4-6222080caa21@2ndquadrant.com/
Also on:    postgresql.org/message-id/af76601d-5483-d718-dda4-6222080caa21@2ndquadrant.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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, robertmhaas@gmail.com, michael.paquier@gmail.com, jaime.casanova@2ndquadrant.com
  Subject: Re: [HACKERS] generated columns
  In-Reply-To: <af76601d-5483-d718-dda4-6222080caa21@2ndquadrant.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