> > create table test_dup (id serial primary key, val text);
>
> > How can I check whether the two rows are the same or different?
>
> Well, with a primary key in there, they had *better* be different.
>
> It would seem you want to see if some *subset* of the columns in two
> rows match? All
Ben Kim wrote:
> create table test_dup (id serial primary key, val text);
> How can I check whether the two rows are the same or different?
Well, with a primary key in there, they had *better* be different.
It would seem you want to see if some *subset* of the columns in two
rows match? A
On Tue, Oct 12, 2010 at 3:10 PM, Ben Kim wrote:
> 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 t
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
-
On Tue, Oct 12, 2010 at 1:17 PM, Ben Kim 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 val
Ben Kim writes:
> What is the best way to compare two rows from within psql cli client?
In 8.4 and up you can just compare the row values, eg
select x.* = y.*
if x and y are known to be of the same rowtype.
regards, tom lane
--
Sent via pgsql-admin mailing list
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 wri