Subject: Require suggestion for issue #8007

From: Pravesh Sharma <[email-masked]>
Date: Tue, 8 Oct 2024 18:26:16 +0530

Hi Hackers,

We have been working on issue #8007
<https://github.com/pgadmin-org/pgadmin4/issues/8007>. After our analysis,
we found that the length and scale of the argument's data type are not
stored in the database server, making it difficult to fetch. In the
debugger, pgAdmin typecasts the provided value to its data type when
calling the function, which is causing the issue.

If we typecast the value to a character without specifying the length, it
is treated as a character (1) (character of length 1). For example, the
output of SELECT 'pgadmin', 'pgadmin'::character; is different.

There are two solutions we can consider:

   1. Do not typecast if the data type is character.
   2. Typecast to varchar when the data type is character.

Please provide your suggestions which solution looks good to you.

Thanks,
Pravesh
-- 

Pravesh Sharma

Software Engineer

+91 9406461406

enterprisedb.com

---

From: Dave Page <[email-masked]>
Date: Tue, 8 Oct 2024 14:04:02 +0100

On Tue, 8 Oct 2024 at 13:56, Pravesh Sharma <[email-masked]>
wrote:

> <https://github.com/pgadmin-org/pgadmin4/issues/8007>. After our
> analysis, we found that the length and scale of the argument's data type
> are not stored in the database server, making it difficult to fetch. In the

Why not include the length in the cast? We know what the input string is,
so can't we just do the equivalent of:

'pgadmin'::character(7);

-- 
Dave Page
pgAdmin: https://www.pgadmin.org
PostgreSQL: https://www.postgresql.org
EDB: https://www.enterprisedb.com

---

From: Pravesh Sharma <[email-masked]>
Date: Tue, 8 Oct 2024 21:00:03 +0530

Hi Dave,

On Tue, Oct 8, 2024 at 6:34 PM Dave Page <[email-masked]> wrote:

>
>
> On Tue, 8 Oct 2024 at 13:56, Pravesh Sharma <
> [email-masked]> wrote:
>
>> Hi Hackers,
>>
Just to confirm, this will be only for the character data type?

---

From: Dave Page <[email-masked]>
Date: Wed, 9 Oct 2024 09:59:43 +0100

On Tue, 8 Oct 2024 at 16:30, Pravesh Sharma <[email-masked]>
wrote:

>>> If we typecast the value to a character without specifying the length,
>>> it is treated as a character (1) (character of length 1). For example, the

Yes, if that's the only type with which the issue is seen.