Re: [HACKERS] 'a' == 'a '

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: "Dann Corbit" <DCorbit(at)connx(dot)com>, "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>, "Terry Fielder" <terry(at)ashtonwoodshomes(dot)com>, "Tino Wildenhain" <tino(at)wildenhain(dot)de>, "Marc G(dot) Fournier" <scrappy(at)postgresql(dot)org>, Richard_D_Levine(at)raytheon(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: [HACKERS] 'a' == 'a '
Date: 2005-10-20 00:06:14
Message-ID: 200510191706.15115.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Dann,

> I think that whatever is done ought to be whatever the standard says.
> If I misinterpret the standard and PostgreSQL is doing it right, then
> that is fine.  It is just that PostgreSQL is very counter-intuitive
> compared to other database systems that I have used in this one
> particular area.  When I read the standard, it looked to me like
> PostgreSQL was not performing correctly.  It is not unlikely that I read
> it wrong.

AFAIT, the standard says "implementation-specific". So we're standard.

The main cost for comparing trimmed values is performance; factoring an
rtrim into every comparison will add significant overhead to the already
CPU-locked process of, for example, creating indexes. We're looking for
ways to make the comparison operators lighter-weight, not heavier.

My general perspective on this is that if trailing blanks are a significant
hazard for your application, then trim them on data input. That requires
a *lot* less peformance overhead than doing it every time you compare
something.

Changing the behaviour would break backwards compatibility for some users.
For that matter, I've been subscribed to 8 PostgreSQL mailing lists since
1999, and this is the first time I can recall someone complaining about
this comparison behavior. So it's obviously not a widespread issue.

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dann Corbit 2005-10-20 00:33:38 Re: [HACKERS] 'a' == 'a '
Previous Message Neil Conway 2005-10-19 22:57:56 Re: PostgreSQL on Dual Processors, Dual-Core AMD Chips

Browse pgsql-hackers by date

  From Date Subject
Next Message Dann Corbit 2005-10-20 00:33:38 Re: [HACKERS] 'a' == 'a '
Previous Message Dann Corbit 2005-10-19 21:49:06 Re: 'a' == 'a ' (Was: RE: [pgsql-advocacy] Oracle buysInnobase)