Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy9sy-00EmN4-8W for pgadmin-hackers@arkaria.postgresql.org; Tue, 08 Oct 2024 13:04:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sy9sw-008avQ-14 for pgadmin-hackers@arkaria.postgresql.org; Tue, 08 Oct 2024 13:04:18 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sy9sv-008auh-Pp for pgadmin-hackers@lists.postgresql.org; Tue, 08 Oct 2024 13:04:17 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sy9st-003DgC-39 for pgadmin-hackers@postgresql.org; Tue, 08 Oct 2024 13:04:17 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5389e24a4d1so6845086e87.3 for ; Tue, 08 Oct 2024 06:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin.org; s=google; t=1728392654; x=1728997454; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=n4E1JXT37QfXTqfAN/Ku5Zi5vfZ8ckEQPT4TjblSTx4=; b=ClOSSsEq/PHQFoW3P4vB1mYSIlp0p64XNcy5TsFNmyYggf1/YXgrClA3V25I+jXCfv ubeB0x7MFgkldvIljYQeXydogwM8AeERelmBYOjXM4aL5HW13uLWhtRiFO0Aj4dbrr42 lT/VA6SW5mzCyAFLYqAxUskTGlTXvo3Aj+DQNADYg7NzMxd/iQDNIccKrYrgQ+Ezlw4J B4Iu9Zl2x8vJq077WA54m4VzvGCA643uXLakf5znHWOzkFcdoYFjmcjydQgEszpcJdfg zlNE10A0lcOuELuRS6e0HAsmGimkmY6pWCYU2QYH268lxFFnnOBDKLMKNNuPVUqjd0ky WlPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728392654; x=1728997454; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=n4E1JXT37QfXTqfAN/Ku5Zi5vfZ8ckEQPT4TjblSTx4=; b=rv4Pk2iiru12VJ3XqtIPIeg6UyKPKfMUvT5Aw312g9h1hTvzySAq1r6tY6cNyhtg51 uPaq5NjRlTGFhrkUYRJWUgEIcVa9XZT5FiWByWfU5kujDry3P68hBr757WDRyF93HAK/ iAKmuG582XISpAUlEAqxgFOeuyfocQao8J4wj+2r04yBVni90hYCIFAEeCooxXSCcEOe u2eJfNosRAY69hpsMa7fvWRVVAdiv1n4m3Y5ZsZ5o3046zeZ2mYG5+M5jYYgF2Dts2ke 0lqWMD/YitoxNZLEGZZw5jAidLqZykru1j+ll4LGmc1uwL+lcQFxD2zIrRj/SnObgkOj +xlQ== X-Gm-Message-State: AOJu0Ywyuz9LDA01fRmEe6Z1Z5p3sN/4vSsHbZPtS5w5VdpvgTKoYZSa vxTgPpL3/7ZWqn56oEqYgH3uVJ4aR/N95WDC4DY8VE5gspEoaqt76tVPInGVvi8PWPBw2iBMSYk 63evzGqsFPK/oXTmljJzej1uCUwAjweirM5RiGj8CTwbipP78Xg== X-Google-Smtp-Source: AGHT+IHaBo1dICzQVfhmIzmWoqFVwR3FydJ7SGPSsPdK6bcQWmpYII0RL6aV5zfu1sJ4HxaOl3EFi6/ckyoOotdeS1w= X-Received: by 2002:a05:6512:e91:b0:535:6ad6:2d40 with SMTP id 2adb3069b0e04-539ab84a6d3mr7386321e87.11.1728392653840; Tue, 08 Oct 2024 06:04:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Page Date: Tue, 8 Oct 2024 14:04:02 +0100 Message-ID: Subject: Re: Require suggestion for issue #8007 To: Pravesh Sharma Cc: pgadmin-hackers@postgresql.org Content-Type: multipart/alternative; boundary="0000000000002a40390623f6c6b6" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002a40390623f6c6b6 Content-Type: text/plain; charset="UTF-8" On Tue, 8 Oct 2024 at 13:56, Pravesh Sharma wrote: > Hi Hackers, > > We have been working on issue #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. > 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 --0000000000002a40390623f6c6b6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Tue, 8 Oct 2024 at 13:56, Pravesh = Sharma <pravesh.sharm= a@enterprisedb.com> wrote:

Hi Hackers,

We have been working on issue #8007. After our analysis, we fo= und that the length and scale of the argument's data type are not store= d in the database server, making it difficult to fetch. In the debugger, pg= Admin typecasts the provided value to its data type when calling the functi= on, which is causing the issue.

If we type= cast 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=C2=A0SELECT 'pgadmin', 'pgadmin'::character;= =C2=A0is different.

Th= ere are two solutions we can consider:

    Do not typecast if the data type is character.
  1. Typecast to= =C2=A0varchar=C2=A0when the data type is c= haracter.
Please provide your s= uggestions which solution looks good to you.

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);
=C2=A0
--
--0000000000002a40390623f6c6b6--