Re: PQftable insufficient for primary key determination

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PQftable insufficient for primary key determination
Дата
Msg-id 20276.1089986098@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PQftable insufficient for primary key determination  (mmc@maruska.dyndns.org (Michal Maruška))
Ответы Re: PQftable insufficient for primary key determination  (mmc@maruska.dyndns.org (Michal Maruška))
Re: PQftable insufficient for primary key determination  (Kris Jurka <books@ejurka.com>)
Список pgsql-general
mmc@maruska.dyndns.org (Michal =?iso-8859-2?q?Maru=B9ka?=) writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> The problem is you haven't said what it is you want to distinguish.

> SELECT * from A, A ....

> gives a result table like:

> p | data | p |data |....
> --------------------
> 1 |  xxx | 2 | yyy | ...


> Now you edit the value  'yyy'  and want to commit this change to the DB:

> update A set data = 'zzz' where  p = primary-key-value;

> How to determine what to use for 'primary-key-value'? The value from the 1st
> column (PQftable gives A) or from the 3rd column (PQftable gives A again)?

I don't think this is a well-defined problem.  What does the user think
he's doing when he edits yyy of the join output?  There may be multiple
copies of that value in the output table, if the row that it came from
joined to multiple rows in the other tables.  In that case it would be
impossible to alter a single field value without changing other rows of
the displayed result.  So at least in the general case, I don't think
it makes sense to allow editing of fields of join results.

If you have knowledge about the form of the query that's sufficient to
guarantee that this problem won't occur, then I'd suggest taking another
look at that knowledge and seeing if it doesn't offer a solution.  But
in the perfectly general form that you've stated the issue, I don't see
a solution.

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: "David Parker"
Дата:
Сообщение: Re: moving an installation
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: moving an installation