Re: Collation rules and multi-lingual databases

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Collation rules and multi-lingual databases
Date: 2003-08-22 22:59:37
Message-ID: Pine.LNX.4.44.0308230055530.3377-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Stark writes:

> This is my first C function so I'm really unsure that I've done the right
> thing. For the most part I pattern-matched off the string_io code in the
> contrib directory.

That was just about the worst example you could have picked. Please
forget everything you have seen and start by reading the documentation.
In particular, learn about the version 1 call convention and about the
PostgreSQL license. And read some code under src/backend/utils/adt.

> In particular I'm unsure about the code postgres-interfacing code in
> c_varcharxfrm which makes an extra copy of both parameters that are passed in
> and an extra copy of the result value. Are varchars guaranteed to be
> nul-terminated?

They are guaranteed not to be null-terminated.

> But more generally. Would it make more sense to use text or bytea or something
> else to store these opaque binary strings? At least with glibc they tend to be
> unreadable anyways.

bytea

> If it's deemed a reasonable approach and nobody has any fatal flaws then I
> expect it would be useful to put in the contrib directory?

I'd expect it to be too slow to be useful. Have you run performance tests?

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2003-08-22 23:08:06 Re: Collation rules and multi-lingual databases
Previous Message Josh Berkus 2003-08-22 22:42:19 Re: Single-file DBs WAS: Need concrete "Why Postgres