Re: Achieving ordered update

From: Bopolissimus Platypus Jr <bopolissimus(dot)lists(at)gmail(dot)com>
To: Allan Kamau <kamauallan(at)gmail(dot)com>
Cc: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Achieving ordered update
Date: 2010-03-28 21:36:03
Message-ID: f7edef431003281436j3d7b9bc4qc541bc569bb3031e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 26, 2010 at 1:02 AM, Allan Kamau <kamauallan(at)gmail(dot)com> wrote:

> A classic problem. I would like to assign integer values (from a
> sequence) to records in a table based on the order (of contents) of
> other field(s) in the same table.

Do you have a simple example? (create table, insert some data, then show what
the output should look like, or what the data would look like after a
transformation
that would set the integer value from that sequence.

do you mean to set a column in that row with that "integer value (from
a sequence)"?
or will you be filling a column in some other table with that "integer
value..."?

what is the function for determining the integer value based on the input data?

In fact, what is the input data: do you mean "other field(s) in the
same *row*" or
do you really mean "table" in that sentence?

is your function guaranteed to never have collisions (two rows
requiring the same
integer)? if there are collisions, how do you handle them?

The "problem" isn't specified completely enough for me (probably others too,
although one or two might have a hint if they've solved something
similar already
and so will have enough context to deduce what you mean) to even gain a
mental model of just what you're trying to solve.

tiger

--
Gerald Timothy Quimpo http://bopolissimus.blogspot.com
bopolissimus(dot)lists(at)gmail(dot)com bopolissimus(at)gmail(dot)com
Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2010-03-28 21:46:19 Re: How many Mandatory Process are there in Postgres
Previous Message Andrus 2010-03-28 20:48:28 Re: Splitting text column to multiple rows