Re: Fwd: Silly question about numbering of rows?
| От | Brett W. McCoy |
|---|---|
| Тема | Re: Fwd: Silly question about numbering of rows? |
| Дата | |
| Msg-id | Pine.LNX.4.30.0103130922200.1283-100000@chapelperilous.net обсуждение исходный текст |
| Ответ на | Fwd: Silly question about numbering of rows? (Ken Corey <ken.corey@atomic-interactive.com>) |
| Ответы |
Re: Fwd: Silly question about numbering of rows?
|
| Список | pgsql-novice |
On Tue, 13 Mar 2001, Ken Corey wrote:
> Moderator, please don't approve the other two posts I've made...just this one
> is plenty...;^)
Not a moderated list.
> I have a table like this:
>
> id | make | model | year | value
> ---------+-----------+--------+-------+-------
> 57 | 2 | 0 | 4 | 4750
> 57 | 2 | 3 | 4 | 4750
> 57 | 2 | 0 | 0 | 4750
> 57 | 2 | 0 | 3 | 4750
> 57 | 2 | 3 | 0 | 4750
> 57 | 2 | 3 | 3 | 4750
> 2 | 2 | 0 | 3 | 4750
> 2 | 2 | 3 | 3 | 4750
> 2 | 2 | 0 | 4 | 4350
> 2 | 2 | 3 | 4 | 4350
> 2 | 2 | 0 | 0 | 4750
> 2 | 2 | 0 | 5 | 4750
> 2 | 2 | 3 | 0 | 4750
> 2 | 2 | 3 | 5 | 4750
The potential for duplicate records is rampant here. What is the primary
key? Do these values use foreign keys?
> Everything is working swimmingly, except for the numbering magic. As you can
> see there are several variations of data in that table, so I can't use a
> serial on the table directly.
Why not? The serial number can be used exclusively for identifying a
unique row. That's definitely the easiest way to do this numbering.
> Further, this table is likely to change on a minute by minute basis, so I
> don't want to create a permanent numbering that will just have to be changed.
Ah, that is a problem.
> It sounds easiest to me to just punt and number the rows as they are returned
> in my calling application...
That might be the way to go, if the ordering and numbering is changing
constantly.
-- Brett
http://www.chapelperilous.net/~bmccoy/
------------------------------------------------------------------------
I don't mind what Congress does, as long as they don't do it in the
streets and frighten the horses.
-- Victor Hugo
В списке pgsql-novice по дате отправления: