Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
All versions of PostgreSQL. Add an additional version-specific tag like [postgresql-13] if that context is relevant.
4
votes
Accepted
Partial unique constraint spanning multiple tables in postgres
Postgres directly supports table inheritance, which does the trick:
CREATE TABLE base_possession (
possession_id SERIAL PRIMARY KEY
);
CREATE TABLE possession (
possession_id INTEGER NOT NULL RE …
8
votes
2
answers
11k
views
Partial unique constraint spanning multiple tables in postgres
To enforce partial uniqueness in postgres, it is a well known workaround to create a partial unique index instead of an explicit constraint, like so:
CREATE TABLE possession (
possession_id serial …
3
votes
Partial unique constraint spanning multiple tables in postgres
Not an answer for postgres, but may be useful nevertheless to someone using Oracle who stumbles across this:
Oracle allows partial uniqueness to be enforced across multiple tables using a fast refresh …