| От | Ed L. |
|---|---|
| Тема | Re: integrity of column used to order rows |
| Дата | |
| Msg-id | 200303190950.45766.pgsql@bluepolka.net обсуждение |
| Ответ на | integrity of column used to order rows (cliff@cliffmeyers.com) |
| Список | pgsql-sql |
On Wednesday March 19 2003 9:18, cliff@cliffmeyers.com wrote: > > What I want to be able to do is make sure that at all times the child > records linked to a parent record have values for the "rank" field that > are consecutive starting at 1, ie (1,2,4,5,6) not (1,2,4,5,7). > > Can someone offer the best suggestion to do this? This is certainly possible via a triggered PL/pgSQL function. Of course, whether or not it is feasible w/r/t performance or exactly how you choose to set the ranks depends on your context. If you have appropriate indices on the foreign key to the parent table, the overall size of the table is probably irrelevant; use of the index would allow you to avoid traversal of the entire table. You also have the option of writing the function in C to get better performance. Ed
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера