pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joachim Trinkwitz <jtr@uni-bonn.de>
To: pgsql-sql@postgresql.org
Subject: Re: INSERT only under certain conditions (SELECT)
Date: 08 Jul 2002 17:49:56 +0200
Message-ID: <87y9cm1aor.fsf@waffel.germanistik.uni-bonn.de> (raw)
In-Reply-To: <20020708124013.GA30022@wolff.to>
References: <874rfb6mqe.fsf@wabe.germanistik.uni-bonn.de>
	<20020708124013.GA30022@wolff.to>

Maybe I should explain my problem a little bit: simplified, I have two
tables, L and T, (which values references to L):

L:

 art|kvvnr|semester
 ---+-----+--------
 7.0| 4151| 2002ws
 7.0| 4326| 2002ws
 6.1| 4200| 2002ws
 7.0| 4151| 2001ws

(combination of kvvnr and semester is unique)

T:

  id |semester|kvvnr
 ----+--------+-----
  123| 2002ws |4151
  123| 2001ws |4151

Now I want to allow a user with id 123 only to insert a row in T if he
doesn't choose values from L with same 'art' and 'semester' values --
in the examples user 123 has already chosen a kvvnr from semester
2002ws in category 'art', so he shouldn't be allowed to insert the
values of the second row in table L.

I hope, someone has followed this complicated thing up to here and
there is a solution for my problem.

Greetings and thanks for your answers by now and further on,
joachim





view thread (5+ messages)  latest in thread

Message-ID: <87y9cm1aor.fsf@waffel.germanistik.uni-bonn.de>
Permalink:  ../87y9cm1aor.fsf@waffel.germanistik.uni-bonn.de/
Also on:    postgresql.org/message-id/87y9cm1aor.fsf@waffel.germanistik.uni-bonn.de

 · 

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: jtr@uni-bonn.de
  Subject: Re: INSERT only under certain conditions (SELECT)
  In-Reply-To: <87y9cm1aor.fsf@waffel.germanistik.uni-bonn.de>

* 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