Обсуждение: Display the orginal Upper cases

Поиск
Список
Период
Сортировка

Display the orginal Upper cases

От
"Zhidian Du"
Дата:
When I create a talbe and want to use pg_fieldname to display them, all the
upper cases bacame lower cased

How can I display the orginal cases,

Thanks.

Z. Du


_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com


Re: Display the orginal Upper cases

От
Justin Clift
Дата:
Hi Zhidian,

You could quote (put " around them) the uppercase table names when you
create them.

For example:

CREATE TABLE Foo (idnum serial, something varchar(10))

would really create a table called "foo", as PostgreSQL automatically
lowercases it.

But if you do this:

CREATE TABLE "Foo" (idnum serial, something varchar(10))

then it will create a table called "Foo", because PostgreSQL respects
the quotes.

This does have the side effect that all your queries for the "Foo" table
must be quoted from then on:

i.e. INSERT INTO "Foo" (something) VALUES ("Hello")

And if you do this:

CREATE TABLE "Foo" (idnum serial, something varchar(10))
CREATE TABLE Foo (idnum serial, something varchar(10))

Then you'll end up with two separate tables, one called "Foo" and the
other called "foo", both of which you can use separately as long as you
always get the quoting of names right.

An alternative approach is to use any of PHP's string functions that
automatically uppercase text.  No good examples are coming to mind at
the moment, but if they are in the PHP manual in the "strings" section
of the Function Reference.

:-)

Regards and best wishes,

Justin Clift


Zhidian Du wrote:
>
> When I create a talbe and want to use pg_fieldname to display them, all the
> upper cases bacame lower cased
>
> How can I display the orginal cases,
>
> Thanks.
>
> Z. Du
>
> _________________________________________________________________
> Join the world’s largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
   - Indira Gandhi