From: | Ben Kim <bkim(at)tamu(dot)edu> |
---|---|
To: | Richard Broersma <richard(dot)broersma(at)gmail(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: compare two rows |
Date: | 2010-10-12 22:10:55 |
Message-ID: | 20101012221055.GC985@tamu.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Thanks.
I'm on 8.4.2.
I was not clear but the two rows are from the same table. Here's the test case.
create table test_dup (id serial primary key, val text);
insert into test_dup(val)values('some text');
insert into test_dup(val)values('some texta');
select * from test_dup;
id | val
----+------------
1 | some text
2 | some texta
How can I check whether the two rows are the same or different?
Thanks.
On Tue, Oct 12, 2010 at 02:12:36PM -0700, Richard Broersma wrote:
> On Tue, Oct 12, 2010 at 1:17 PM, Ben Kim <bkim(at)tamu(dot)edu> wrote:
> > Admins,
> >
> > What is the best way to compare two rows from within psql cli client?
> >
> > It has ~30 fields, and the two rows are duplicate data but there might
> > be differences.
> >
> > id field1 field2 field3 ...
> > ===========================
> > id1 value1 value2 value3 ...
> > id2 value1 value2 value3 ...
> >
> > I could write a generic script to iterate through the list of fields and
> > compare each field values, or concatenate the fields to a string, but wondered what is out there.
> >
> > Also, is there a way around to use select row(...) = row(...)?
>
> Does: (T1.value1,T1.value2, T1.value3, ... ) IS NOT DISTINCT FROM
> (T2.value1,T2.value2, T2.value3,...)
> or: Row( T1.* ) IS NOT DISTINCT FROM ( T2.* )
> work for you?
>
>
>
>
>
> --
> Regards,
> Richard Broersma Jr.
>
> Visit the Los Angeles PostgreSQL Users Group (LAPUG)
> http://pugs.postgresql.org/lapug
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2010-10-12 22:17:23 | Re: compare two rows |
Previous Message | Richard Broersma | 2010-10-12 21:12:36 | Re: compare two rows |