pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Converting yes or no to one letter strings.
Date: Wed, 5 Jun 2019 07:20:15 -0700
Message-ID: <1ccaf983-78ab-28d9-23e3-a7bbd4e53344@aklaver.com> (raw)
In-Reply-To: <b2a5e8b9-902e-bb0c-4b53-5e6ae2db464e@gmail.com>
References: <555b017e-2449-43a4-19e6-4c19af6017e3@dayspringpublisher.com>
	<bf35f900-6500-dfc7-b93d-f264767bdb38@aklaver.com>
	<b2a5e8b9-902e-bb0c-4b53-5e6ae2db464e@gmail.com>

On 6/4/19 7:27 PM, Ron wrote:
> 
> 
> On 6/4/19 7:19 PM, Adrian Klaver wrote:
>> On 6/4/19 3:29 PM, Lou wrote:
>>> Hi everyone,
>>>
>>> Is it possible to convert a boolean yes or no field to hold a one 
>>> letter string? For example, the strings: 's' 'f' 'p' 'e'
>>>
>>> To start off, I just need to convert true to 's'. false will have to 
>>> be manually changed to 'f' or 'p' or 'e' as appropriate.
>>
>> Why not an enum field?:
>>
>> https://www.postgresql.org/docs/11/datatype-enum.html
> 
> I thought enum was Considered Harmful because of the difficulty in 
> altering the enums?
> 

The difficulty is removing a value:

https://www.postgresql.org/docs/11/sql-altertype.html

Otherwise I see equal difficulty in pretending that s, f, p and e are a 
boolean choice.

-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (10+ messages)  latest in thread

Message-ID: <1ccaf983-78ab-28d9-23e3-a7bbd4e53344@aklaver.com>
Permalink:  ../1ccaf983-78ab-28d9-23e3-a7bbd4e53344@aklaver.com/
Also on:    postgresql.org/message-id/1ccaf983-78ab-28d9-23e3-a7bbd4e53344@aklaver.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: adrian.klaver@aklaver.com, ronljohnsonjr@gmail.com
  Subject: Re: Converting yes or no to one letter strings.
  In-Reply-To: <1ccaf983-78ab-28d9-23e3-a7bbd4e53344@aklaver.com>
  References: <555b017e-2449-43a4-19e6-4c19af6017e3@dayspringpublisher.com> <bf35f900-6500-dfc7-b93d-f264767bdb38@aklaver.com> <b2a5e8b9-902e-bb0c-4b53-5e6ae2db464e@gmail.com> <1ccaf983-78ab-28d9-23e3-a7bbd4e53344@aklaver.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