workarounds for ci_text

From: Heine Ferreira <heine(dot)ferreira(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: workarounds for ci_text
Date: 2016-02-04 11:48:37
Message-ID: CAMuqQjecF99xaZLbZ4o-bBjr6THgBM11MHqtd3+ScGZAWN29Dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

As far as I can tell, you can't restrict the length of a ci_text field like
char(5) or varchar(5)?
Let's say you got a stock table and you want an alphanumeric stock
code that is the primary key but it must be case insensitive can I do
something like this:

create table stock(stock code varchar(5), stock_desc varchar(50))
primary key pk_stock_code ilike(stock_code)

Will this work? Is this the right syntax?

Thanks

H.F.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2016-02-04 12:25:16 Re: workarounds for ci_text
Previous Message Karsten Hilbert 2016-02-04 11:05:32 Re: [SQL] Q: documentation bug ?