Lists: | pgsql-hackers |
---|
From: | Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com> |
---|---|
To: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Making error message more user-friendly with spaces in a URI |
Date: | 2024-10-31 01:22:11 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hi,
I made a patch to make the error message more user-friendly when using a
URI to connect a database with psql.
Current Error Message:
$ psql "postgres://localhost:5432/postgres?application_name=a b"
psql: error: trailing data found: "a b"
Currently, if spaces exist in the URI, psql displays this generic error
message.
New Error Message (with patch):
psql: error: found unexpected spaces: “a b“. Did you forget to
percent-encode spaces?
This revised message is clearer and more concise, guiding users to check
for encoding issues.
Regards,
Yushi Ogiwara
Attachment | Content-Type | Size |
---|---|---|
user_friendly_error.diff | text/x-diff | 523 bytes |
From: | Stepan Neretin <sndcppg(at)gmail(dot)com> |
---|---|
To: | Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-10-31 15:35:41 |
Message-ID: | CAMaYL5Y1NOs==NAxGVDoBiB19f5oBCfTVnmPf1X5RP+RhwRtew@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
>
> I made a patch to make the error message more user-friendly when using a
> URI to connect a database with psql.
>
Hi, Yushi! I could not find this line in the master branch and I couldn't
apply this patch. I only see this error in the test (I think the test
should also be changed), but the idea of fixing the error looks good to me.
Best Regards, Stepan Neretin!
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Stepan Neretin <sndcppg(at)gmail(dot)com> |
Cc: | Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-01 00:50:02 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Oct 31, 2024 at 10:35:41PM +0700, Stepan Neretin wrote:
> Hi, Yushi! I could not find this line in the master branch and I couldn't
> apply this patch. I only see this error in the test (I think the test
> should also be changed), but the idea of fixing the error looks good to me.
This line exists on HEAD and the patch applies cleanly today as of
2d8bff603c9e. So perhaps just make sure that you are up to date?
--
Michael
From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
---|---|
To: | Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-01 13:38:57 |
Message-ID: | CAKAnmmKkz+kWopLhkAepKwvBdoNv8_ESfuzR9aR8PnD3Z8rMgQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
>
> $ psql "postgres://localhost:5432/postgres?application_name=a b"
> psql: error: trailing data found: "a b"
>
This works fine for me, and sets a space in the application_name string as
expected. Do you have a different example?
Cheers,
Greg
From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
---|---|
To: | Greg Sabino Mullane <htamfids(at)gmail(dot)com>, Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com> |
Cc: | Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-05 16:05:14 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 2024/11/01 22:38, Greg Sabino Mullane wrote:
> $ psql "postgres://localhost:5432/postgres?application_name=a b"
> psql: error: trailing data found: "a b"
>
>
> This works fine for me, and sets a space in the application_name string as expected. Do you have a different example?
You'll encounter the error message if you run the example command against HEAD.
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
From: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
---|---|
To: | Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-05 16:09:12 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 2024/10/31 10:22, Yushi Ogiwara wrote:
> Hi,
>
> I made a patch to make the error message more user-friendly when using a URI to connect a database with psql.
>
> Current Error Message:
>
> $ psql "postgres://localhost:5432/postgres?application_name=a b"
> psql: error: trailing data found: "a b"
>
> Currently, if spaces exist in the URI, psql displays this generic error message.
>
> New Error Message (with patch):
>
> psql: error: found unexpected spaces: “a b“. Did you forget to percent-encode spaces?
>
> This revised message is clearer and more concise, guiding users to check for encoding issues.
I agree the error message could be improved.
The phrasing "Did you forget" feels a bit indirect to me.
How about using something clearer and more direct instead?
-----------
psql: error: unexpected spaces found "a b", use percent-encoded spaces instead
-----------
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com> |
Cc: | Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-18 19:59:18 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Nov 6, 2024 at 01:09:12AM +0900, Fujii Masao wrote:
>
>
> On 2024/10/31 10:22, Yushi Ogiwara wrote:
> > Hi,
> >
> > I made a patch to make the error message more user-friendly when using a URI to connect a database with psql.
> >
> > Current Error Message:
> >
> > $ psql "postgres://localhost:5432/postgres?application_name=a b"
> > psql: error: trailing data found: "a b"
> >
> > Currently, if spaces exist in the URI, psql displays this generic error message.
> >
> > New Error Message (with patch):
> >
> > psql: error: found unexpected spaces: “a b“. Did you forget to percent-encode spaces?
> >
> > This revised message is clearer and more concise, guiding users to check for encoding issues.
>
> I agree the error message could be improved.
>
> The phrasing "Did you forget" feels a bit indirect to me.
> How about using something clearer and more direct instead?
>
> -----------
> psql: error: unexpected spaces found "a b", use percent-encoded spaces instead
> -----------
+1
--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com
When a patient asks the doctor, "Am I going to die?", he means
"Am I going to die soon?"
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-19 00:29:27 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Nov 18, 2024 at 02:59:18PM -0500, Bruce Momjian wrote:
> On Wed, Nov 6, 2024 at 01:09:12AM +0900, Fujii Masao wrote:
>> The phrasing "Did you forget" feels a bit indirect to me.
>> How about using something clearer and more direct instead?
>>
>> -----------
>> psql: error: unexpected spaces found "a b", use percent-encoded spaces instead
>> -----------
>
> +1
Could it be better to mention %20 in the error message? Say an
addition like:
"unexpected spaces found \"%s\", use percent-encoded spaces (%%20)
instead"
--
Michael
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-19 00:52:08 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
Michael Paquier <michael(at)paquier(dot)xyz> writes:
> Could it be better to mention %20 in the error message? Say an
> addition like:
> "unexpected spaces found \"%s\", use percent-encoded spaces (%%20) instead"
+1. Also the grammar seems a bit off; how about
"unexpected spaces found in \"%s\", use percent-encoded spaces (%%20) instead"
regards, tom lane
From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Yushi Ogiwara <btogiwarayuushi(at)oss(dot)nttdata(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Making error message more user-friendly with spaces in a URI |
Date: | 2024-11-19 01:15:28 |
Message-ID: | [email protected] |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Mon, Nov 18, 2024 at 07:52:08PM -0500, Tom Lane wrote:
> +1. Also the grammar seems a bit off; how about
>
> "unexpected spaces found in \"%s\", use percent-encoded spaces (%%20) instead"
That's better, thanks. This one's on me, so I think that I'll just go
fix that today with this wording. This patch was on my bucket list,
just lost sight of it.
--
Michael