2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PostgreSQLでcase-insensitiveなカラムを作る

Last updated at Posted at 2021-03-07

citext型を使う。

インストール

$ sudo apt install postgresqsl-contrib

CREATE EXTENSION

CREATE EXTENSION に特殊な権限が必要なので、面倒ならpostgresユーザーを使う。

$ sudo su postgres
$ psql dbname
> create extension citext
> \dx

psqlを叩く際データベースを指定しないと、対象データベースで認識されないことに注意。

使う

> alter table users alter column login type citext;
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?