Re: psql shows line number

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql shows line number
Date: 2013-11-26 12:17:11
Message-ID: CAFj8pRC1ruPk6+chA1jpxPh3uS_zipaBDOvmcEex4wPbp2kZMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2013/11/26 Sawada Masahiko <sawada(dot)mshk(at)gmail(dot)com>

> Hi all,
>
> When I execute query which contains error, the server returns error
> with line number.
>
> ERROR: relation "hoge" does not exist
> LINE 35: hoge;
>
> But when query is long, I was not sure the location where I wrote wrong
> SQL.
> Does the psql have option which shows line number?
> If no, I'm thinking to implement this feature. Thought?
> I think it is useful if the psql shows line number like follows
>
> [1]postgres=# SELECT
> [2]postgres=# hoge.col1
> [3]postgres=# FROM
> [4]postgres=# hoge;
>
> ERROR: column "col1" does not exist
> LINE 2: col1
>
> And If there is discussion at past about this, please let me know.
>

idea is interesting, but a proposed format is not clean (and little bit
ugly, and can be barrier for copy from terminal to editor. Now, simple
replace can be used for cleaning.

maybe we can introduce a command, that will print SQL from history with
line numbers - like \sf+

regards

Pavel

>
> Regards,
>
> -------
> Sawada Masahiko
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2013-11-26 12:23:14 Re: psql shows line number
Previous Message Bruce Momjian 2013-11-26 12:14:27 Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block