From: | Robert Paulsen <robert(at)paulsenonline(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | PHP and PostgreSQL question on identifier limits. |
Date: | 2004-08-15 21:55:43 |
Message-ID: | 200408151655.43775.robert@paulsenonline.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
I am migrating from MySQL to PostgreSQL and ran into a limitation of
PostgreSQL. I ran into this because of a technique I use for displaying
results of a SELECT query. In some cases I like to have the heading of some
columns in the table be clickable, usually to sort output by that column.
I have common a function I use that displays the results of a query in an HTML
table with the column headings being the field names. Here is a snippet of
code showing a typical query:
=======================================================
$_GET['sort'] && $_SESSION['sort']=$_GET['sort'];
$sort=$_SESSION['sort'];
$sort || $sort="field1";
$query="SELECT
field1 AS \"<a href=$PHP_SELF?sort=field1>field1</a>\",
field2 AS \"<a href=$PHP_SELF?sort=field2>field2</a>\",
field3 AS \"<a href=$PHP_SELF?sort=userid>field3</a>\"
FROM my_table ORDER BY $sort";
$tbl=new Table($query);
$tbl->print();
=======================================================
The problem I ran into is when the "AS" exceeds 63 characters --- which it
does NOT in the above example, but sometimes DOES in more complex real-life
queries. In those cases I get a PostgreSQL error saying that the identifier
is too long. Looking at the PostgreSQL documentation I see this is set to 63
characters by default but can be changed with a recompile.
Before I recompile PostgreSQL I would like to re-think my strategy for making
column headings clickable links.
Does anyone else create HTML tables with clickable headers? If so, do you use
a similar or different technique?
--
Robert C. Paulsen, Jr.
robert(at)paulsenonline(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Mascari | 2004-08-15 23:23:40 | Re: PHP Postgre-MySql call redirector |
Previous Message | Chris Travers | 2004-08-15 21:37:42 | Re: Virtual Private Database Functionality |