Re: Weird issue with truncation of values in array with some tables

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Mike Martin <redtux1(at)gmail(dot)com>
Cc: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: Re: Weird issue with truncation of values in array with some tables
Date: 2020-08-16 15:13:20
Message-ID: CAKFQuwaFeFtWRWe5AzbP5UD6UZD-i8KRCMuSjV-RS8CpTR38dw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, Aug 16, 2020, 06:49 Mike Martin <redtux1(at)gmail(dot)com> wrote:

> Hi
> I have come across a weird issue with truncation of text in an array (in
> this case using pg_indexes view)
>
> This query truncates the second array element at 63 characters
> SELECT ARRAY[indexname,indexdef] FROM pg_indexes
>
> However reversing the order doesn't truncate
>
> SELECT ARRAY[indexdef,indexname] FROM pg_indexes
>
> Anyone know why this behaviour occurs?
>

It's likely related to the following:

https://www.postgresql.org/docs/12/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

The system uses no more than NAMEDATALEN-1 bytes of an identifier; longer
names can be written in commands, but they will be truncated. By default,
NAMEDATALEN is 64 so the maximum identifier length is 63 bytes.

David J.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2020-08-16 17:12:50 Re: Weird issue with truncation of values in array with some tables
Previous Message Mike Martin 2020-08-16 13:48:16 Weird issue with truncation of values in array with some tables