pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
PostgreSQL appears to truncate column alias names after 31 characters.
2+ messages / 2 participants
[nested] [flat]

* PostgreSQL appears to truncate column alias names after 31 characters.
@ 2024-10-01 07:06 Manish Singh <manish.singh@india.corelynx.com>
  2024-10-01 08:40 ` Re: PostgreSQL appears to truncate column alias names after 31 characters. Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 1 reply; 2+ messages in thread

From: Manish Singh @ 2024-10-01 07:06 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Hello, 
I am using pgsql with laravel. I have noticed that PostgreSQL appears to truncate column alias names 
after 31 characters. 

For example (this is from the psql command-line tool): 

SELECT rss_headline_id as abcdefghijklmno pqrstuvwxyz1234 56, title, url 
FROM news_rss_headli nes headlines WHERE rss_headline_id = 22833; 
NOTICE: identifier "abcdefghijklmn opqrstuvwxyz123 456" will be 
truncated to "abcdefghijklmn opqrstuvwxyz123 45" 

Granted, having alias names this long may seem a little goofy, but I 
am working on an object Persistence Layer that has the capability of 
sometimes generating long aliases behind the scenes. 

Does anyone know if this is a known limitation to PostgreSQL ? (I 
couldn't find any documentation which specifically addresses this 
issue) Is there a way to make PostreSQL support longer alias names? 
Are there any plans to address this in future version of PostgreSQL? 
Or... should I just "suck it up" and fix my code? ;-). 

Please suggest me how can i solve this problem.I can not switch my RDBMS from PGSQL to others 

Any insights or comments would be appreciated. 

Thanks, 
Manish Kumar Singh 

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: PostgreSQL appears to truncate column alias names after 31 characters.
  2024-10-01 07:06 PostgreSQL appears to truncate column alias names after 31 characters. Manish Singh <manish.singh@india.corelynx.com>
@ 2024-10-01 08:40 ` Laurenz Albe <laurenz.albe@cybertec.at>
  0 siblings, 0 replies; 2+ messages in thread

From: Laurenz Albe @ 2024-10-01 08:40 UTC (permalink / raw)
  To: Manish Singh <manish.singh@india.corelynx.com>; pgsql-bugs@lists.postgresql.org

On Tue, 2024-10-01 at 07:06 +0000, Manish Singh wrote:
> I am using pgsql with laravel.I have noticed that PostgreSQL appears to truncate column alias names
> after 31 characters.
> 
> For example (this is from the psql command-line tool):
> 
> SELECT rss_headline_id as abcdefghijklmno pqrstuvwxyz1234 56, title, url
> FROM news_rss_headli nes headlines WHERE rss_headline_id = 22833;
> NOTICE: identifier "abcdefghijklmn opqrstuvwxyz123 456" will be
> truncated to "abcdefghijklmn opqrstuvwxyz123 45"

I cannot reproduce that.
Unless you modify the source, identifiers will be cut off after 63 bytes
(NAMEDATALEN - 1; one byte is for the terminating zero byte).

Did you modify the source?
Also, the spaces in your identifier should cause a syntax error.
Can you explain why you don't get such an error?

Yours,
Laurenz Albe





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-10-01 08:40 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-10-01 07:06 PostgreSQL appears to truncate column alias names after 31 characters. Manish Singh <manish.singh@india.corelynx.com>
2024-10-01 08:40 ` Laurenz Albe <laurenz.albe@cybertec.at>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox