Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > Re: PATCH: CITE...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 15 Topic 9610 of 11013
Post > Topic >>

Re: PATCH: CITEXT 2.0

by tgl@[EMAIL PROTECTED] (Tom Lane) Jul 3, 2008 at 01:14 AM

"David E. Wheeler" <david@[EMAIL PROTECTED]
> writes:
> On Jul 2, 2008, at 09:13, Zdenek Kotala wrote:
>> Please, do not type space before asterix:
>> char * lcstr, * rcstr -> char *lcstr, *rcstr
>> 
>> and do not put extra space in a brackets
>> citextcmp( left, right )  -> citextcmp(left, right)

> Okay.

Note that this sort of stuff will mostly be fixed by pg_indent,
whether or not David does anything about it.  But certainly
conforming to the project style to begin with will cause less
pain to reviewers' eyeballs.

> Um, are you referring to this (at the top):

> +// PostgreSQL 8.2 Magic.
> +#ifdef PG_MODULE_MAGIC
> +PG_MODULE_MAGIC;
> +#endif

Here however is an outright bug: we do not allow // comments, because we
still sup****t ANSI-spec compilers that don't recognize them.

> Yeah, I'm a bit confused by this. I followed what's in varlena.c on  
> this. The comparison functions are do***ented supposed to return 1, 0,  
> or -1, which of course would be covered by int. But varstr_cmp(),  
> which ultimately returns the value, returns all kinds of numbers. So,  
> perhaps someone could say what it's *supposed* to be?

btree cmp functions are allowed to return int32 negative, zero, or
positive.  There is *not* any requirement that negative or positive
results be exactly -1 or +1.  However, if you are comparing values
that are int32 or wider then you can't just return their difference
because it might overflow.

>> 3) citext_larger, citext_smaller function have memory leak. You  
>> don't call PG_FREE_IF_COPY on unused text.

> These I also duplicated from varlena.c, and I asked about a potential  
> memory leak in a previous email. If there's a leak here, would there  
> not also be a leak in varlena.c?

The "leak" is irrelevant for larger/smaller.  The only place where it's
actually useful to do PG_FREE_IF_COPY is in a btree or hash index
sup****t function.  In other cases you can assume that you're being
called in a memory context that's too short-lived for it to matter.

>> 5) There are several commented out lines in CREATE OPERATOR  
>> statement mostly related to NEGATOR. Is there some reason for that?

> I copied it from the original citext.sql. Not sure what effect it has.

http://developer.postgresql.org/pgdocs/postgres/xoper-optimization.html

			regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 15 Posts in Topic:
Re: PATCH: CITEXT 2.0
Zdenek.Kotala@[EMAIL PROT  2008-07-02 18:13:52 
Re: PATCH: CITEXT 2.0
teodor@[EMAIL PROTECTED]   2008-07-02 23:18:49 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-02 21:40:12 
Re: PATCH: CITEXT 2.0
teodor@[EMAIL PROTECTED]   2008-07-03 11:19:26 
Re: PATCH: CITEXT 2.0
teodor@[EMAIL PROTECTED]   2008-07-03 11:31:06 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-03 09:03:10 
Re: PATCH: CITEXT 2.0
alvherre@[EMAIL PROTECTED  2008-07-03 12:53:15 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-04 22:39:54 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-02 21:38:32 
Re: PATCH: CITEXT 2.0
tgl@[EMAIL PROTECTED] (T  2008-07-03 01:14:14 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-03 09:01:17 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-04 22:54:45 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-04 23:06:36 
Re: PATCH: CITEXT 2.0
tgl@[EMAIL PROTECTED] (T  2008-07-05 11:13:20 
Re: PATCH: CITEXT 2.0
david@[EMAIL PROTECTED]   2008-07-05 17:47:11 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Dec 5 9:04:28 CST 2008.