From: | Seamus Abshere <seamus(at)abshere(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Comparing results of regexp_matches |
Date: | 2014-11-16 23:52:35 |
Message-ID: | 1416181955.4001205.191714341.29494AC6@webmail.messagingengine.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
hi,
I want to check if two similar-looking addresses have the same numbered
street, like 20th versus 21st.
2033 21st Ave S
2033 20th Ave S (they're different)
I get an error:
# select regexp_matches('2033 21st Ave S', '\m(\d+(?:st|th))\M') =
regexp_matches('2033 20th Ave S', '\m(\d+(?:st|th))\M');
ERROR: functions and operators can take at most one set argument
I've tried `()[1] == ()[1]`, etc. but the only thing that works is
making it into 2 subqueries:
# select (select * from regexp_matches('2033 21st Ave S',
'\m(\d+(?:st|th))\M')) = (select * from regexp_matches('2033 20th
Ave S', '\m(\d+(?:st|th))\M'));
?column?
----------
f
(1 row)
Is there a more elegant way to compare the results of
`regexp_matches()`?
Thanks,
Seamus
--
Seamus Abshere, SCEA
https://github.com/seamusabshere
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Atkins | 2014-11-17 01:26:30 | Re: Comparing results of regexp_matches |
Previous Message | Jim Nasby | 2014-11-15 04:57:27 | Re: NEW in after insert trugger contained incorrect data |