pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: mykarz@miyabara.com
Cc: Pgsql-sql@postgresql.org
Subject: Re: regcomp failed with error empty (sub)expression?
Date: Fri, 22 Dec 2000 01:06:27 -0500
Message-ID: <4054.977465187@sss.pgh.pa.us> (raw)
In-Reply-To: <005b01c06bd9$50c7a3b0$c700a8c0@ncc1701e>
References: <005b01c06bd9$50c7a3b0$c700a8c0@ncc1701e>

"Michael Miyabara-McCaskey" <mykarz@miyabara.com> writes:
> regcomp failed with error empty (sub)expression
> Anys thoughts as to what this means?

I'd say it means the regexp code doesn't like your pattern.  For
example, I can trigger that with

regression=# select 'abc' ~ '|33';
ERROR:  regcomp failed with error empty (sub)expression

'|33' is a bogus pattern because one side of the alternative
construct is empty.  ('|' is the OR pattern operator.)

> The following SQL statement generated the error.

> INSERT INTO table3(table1.oid,table2.oid)
>   SELECT table1.oid, table2.oid
>   FROM table1, table2
>   WHERE table1.field1 ~* table2.field1
>         table1.field2 ~* table2.field2
>         table1.field3 = table2.field3
>         table1.field4 = table2.field4;

Not very helpful when we don't know what's in the table2.field1 and
table2.field2 columns.

> I'm basically trying to do a simply comparison between table1 and table2 to
> find duplicates, but the case differences are stopping me, and as the 7.0.3
> version of "upper()" has memory leaks, and the Plperl verion of uc() that I
> created takes A LONG time to run (I have a LOT of records)... here I am
> trying to match strings with CASE differences.

If you are just trying to match without regard to case, the thing to do
is something like "upper(col1) = upper(col2)".  Using data as a regexp
or LIKE pattern is sheer folly, unless you are *certain* that it can
never contain pattern-operator characters.

			regards, tom lane



view thread (2+ messages)

Message-ID: <4054.977465187@sss.pgh.pa.us>
Permalink:  ../4054.977465187@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4054.977465187@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, mykarz@miyabara.com
  Subject: Re: regcomp failed with error empty (sub)expression?
  In-Reply-To: <4054.977465187@sss.pgh.pa.us>
  References: <005b01c06bd9$50c7a3b0$c700a8c0@ncc1701e> <4054.977465187@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox