| From: | "Brett W(dot) McCoy" <bmccoy(at)chapelperilous(dot)net> |
|---|---|
| To: | Ken Corey <ken(dot)corey(at)atomic-interactive(dot)com> |
| Cc: | <pgsql-novice(at)postgresql(dot)org> |
| Subject: | Re: Fwd: Silly question about numbering of rows? |
| Date: | 2001-03-13 14:26:22 |
| Message-ID: | Pine.LNX.4.30.0103130922200.1283-100000@chapelperilous.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dax Duskin | 2001-03-13 14:34:21 | perl installation problem |
| Previous Message | Louis Bertrand | 2001-03-13 13:40:02 | Re: Not incrementing the 'serial' counter on failed inserts. |