Re: Expression of check constraint - Mailing list pgsql-general

From Dirk Mika
Subject Re: Expression of check constraint
Date
Msg-id 36BCEBBD-0EDD-4D37-897D-E2D3B3733050@mikatiming.de
Whole thread Raw
In response to Re: Expression of check constraint  (rob stone <floriparob@gmail.com>)
List pgsql-general
Hi


--
Dirk Mika
Software Developer

mika:timing GmbH
Strundepark - Kürtener Str. 11b
51465 Bergisch Gladbach
Germany

fon +49 2202 2401-1197
dirk.mika@mikatiming.de
www.mikatiming.de

AG Köln HRB 47509 * WEEE-Reg.-Nr. DE 90029884
Geschäftsführer: Harald Mika, Jörg Mika



## How2Use
## the ChampionChip by mika:timing
## https://youtu.be/qfOFXrpSKLQ
Am 04.07.19, 10:50 schrieb "rob stone" <floriparob@gmail.com>:

    Why don't you define "ratified" as CHAR(1)?

This will change the constraint to

Check constraints:
    "ck_tp_ratified" CHECK (ratified IS NULL OR (ratified = ANY (ARRAY['Y'::bpchar, 'N'::bpchar])))

Less casting. (
Does the casting from one "String" type to another "String" type have any performance impact, btw?

    AFAIK, constraint evaluation is based upon the column's underlying data
    type.

But isn't char and varchar all stored in the same data structure?

Dirk






pgsql-general by date:

Previous
From: rob stone
Date:
Subject: Re: Expression of check constraint
Next
From:
Date:
Subject: Help with a selection