pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mai Peng <maily.peng@webedia-group.com>
To: pgsql-admin@lists.postgresql.org
Subject: Design database
Date: Wed, 3 Feb 2021 16:23:33 +0100
Message-ID: <FDD700F1-0FC8-4242-9C55-9D2CC590F71D@webedia-group.com> (raw)

Hello,

I’ve got a table name publication, and another table named publication_item. 
Each publication_item is linked to a publication by publication_id.
How could I add a constraint that check each publication has one or more publication_item when a tuple is inserted ?
I don’t want to store items in the same table as publication because we could have 1-> n items.

Thank you






view thread (4+ messages)  latest in thread

Message-ID: <FDD700F1-0FC8-4242-9C55-9D2CC590F71D@webedia-group.com>
Permalink:  ../FDD700F1-0FC8-4242-9C55-9D2CC590F71D@webedia-group.com/
Also on:    postgresql.org/message-id/FDD700F1-0FC8-4242-9C55-9D2CC590F71D@webedia-group.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: maily.peng@webedia-group.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Design database
  In-Reply-To: <FDD700F1-0FC8-4242-9C55-9D2CC590F71D@webedia-group.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox