Skip to content

Instantly share code, notes, and snippets.

@ocharles
Created May 27, 2009 13:21
Show Gist options
  • Save ocharles/118637 to your computer and use it in GitHub Desktop.
Save ocharles/118637 to your computer and use it in GitHub Desktop.
musicbrainz_db=# \d artist_name;
Table "musicbrainz_test.artist_name"
Column | Type | Modifiers
----------+------------------------+----------------------------------------------------------
id | integer | not null default nextval('artist_name_id_seq'::regclass)
name | character varying(255) | not null
page | integer | not null
refcount | integer | default 0
Indexes:
"artist_name_pk" PRIMARY KEY, btree (id)
"artist_name_idx_name" UNIQUE, btree (name)
"artist_name_idx_name_txt" gin (to_tsvector('mb_simple'::regconfig, name::text))
musicbrainz_db=# SELECT * FROM artist_name WHERE name = 'Nirvana';
id | name | page | refcount
----+------+------+----------
(0 rows)
musicbrainz_db=# INSERT INTO artist_name (name, page) VALUES ('Nirvana', 1234) RETURNING id;
ERROR: duplicate key value violates unique constraint "artist_name_pk"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment