agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Karen Goh <karenworld@yahoo.com>
To: pgsql-sql@lists.postgresql.org
Subject: Should I add a Index Key in this case ?
Date: Wed, 16 Oct 2019 11:36:36 +0000 (UTC)
Message-ID: <1846839195.1533405.1571225796919@mail.yahoo.com> (raw)
Hi Experts,
I have a use case as follows :
add constraints to the database so that no two reservations for the same viewing may refer to the same seat.
So, say I have a primary key like this in the table A:
SEAT_id integer NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1 ),
CONSTRAINT A_pkey PRIMARY KEY (SEAT_id))
WITH (
OIDS = FALSE
)
TABLESPACE pg_default;
So, basically I would like to create a SEAT_Viewing_Id.
In this case, do I create a Index Key or ?
How should I construct or rather alter my table A to accomodate this SEAT_Viewing_Id ?
Hope someone can tell me how.
Furthermore, whenever an insertion is done via WebApp, I would have to insert the Index key as well or does PostgreSQL will have a way to increment the Index key which is the SEAT_Viewing_Id at the same time?
Thanks & regards,
Karen
view thread (4+ messages) latest in thread
Message-ID: <1846839195.1533405.1571225796919@mail.yahoo.com>
Permalink: ../1846839195.1533405.1571225796919@mail.yahoo.com/
Also on: postgresql.org/message-id/1846839195.1533405.1571225796919@mail.yahoo.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-sql@postgresql.org
Cc: karenworld@yahoo.com, pgsql-sql@lists.postgresql.org
Subject: Re: Should I add a Index Key in this case ?
In-Reply-To: <1846839195.1533405.1571225796919@mail.yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox