Thread: Display line numbers in SQL view

Display line numbers in SQL view

From
"Robins Tharakan"
Date:
Hi,

During constant debugging of triggers / functions in office, I see the need to copy paste a specific SQL string and run it in the SQL view to trace a bug on a given nth line. The problem being that the SQL view doesn't have line numbers in the margin like the Create function SQL tab.

This patch adds line numbers to the SQL view as well.

(This patch just enables the line-numbers in the margin, in case its desirable to have a checkbox that allows the user to enable/disable this, we could have a menu option for that in the View menu. Should we ?)


Regards.
Robins Tharakan
Attachment

Re: Display line numbers in SQL view

From
"Dave Page"
Date:
On Mon, Mar 3, 2008 at 6:29 PM, Robins Tharakan <tharakan@gmail.com> wrote:
> Hi,
>
> During constant debugging of triggers / functions in office, I see the need
> to copy paste a specific SQL string and run it in the SQL view to trace a
> bug on a given nth line. The problem being that the SQL view doesn't have
> line numbers in the margin like the Create function SQL tab.
>
> This patch adds line numbers to the SQL view as well.
>
> (This patch just enables the line-numbers in the margin, in case its
> desirable to have a checkbox that allows the user to enable/disable this, we
> could have a menu option for that in the View menu. Should we ?)

This has been turned on and off repeatedly over the years. I think the
main problem is that some people have quite long scripts for which the
line numbers start to take up a lot of room. I wouldn't be opposed to
making it a configurable option though... but many of the options in
the query tool actually affect other instances of the styled text
control as well. I wonder if now is the time to think about moving
them to the main options dialogue?


--
Dave Page
EnterpriseDB UK Ltd: http://www.enterprisedb.com
PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk

Re: Display line numbers in SQL view

From
"Robins Tharakan"
Date:
Hi Dave,

True. In that case moving it as an option (with sane defaults) did seem like a better way. So attached is a reworked patch that puts two options in frmOptions.

1. A checkbox (in preferences tab) that applies to line numbers universally.
2. One checkbox (in the Query tab) specific to the SQL Query window.

The defaults ensure that the we maintain status quo (i.e. Line numbers are enabled for Functions/Triggers but disabled for Query window).

Regards,
Robins Tharakan

---------- Forwarded message ----------
From: Dave Page <dpage@pgadmin.org>
Date: Tue, Mar 4, 2008 at 3:11 PM
Subject: Re: [pgadmin-hackers] Display line numbers in SQL view
To: Robins Tharakan <tharakan@gmail.com>
Cc: pgadmin-hackers@postgresql.org


On Mon, Mar 3, 2008 at 6:29 PM, Robins Tharakan <tharakan@gmail.com> wrote:
> Hi,
>
> During constant debugging of triggers / functions in office, I see the need
> to copy paste a specific SQL string and run it in the SQL view to trace a
> bug on a given nth line. The problem being that the SQL view doesn't have
> line numbers in the margin like the Create function SQL tab.
>
> This patch adds line numbers to the SQL view as well.
>
> (This patch just enables the line-numbers in the margin, in case its
> desirable to have a checkbox that allows the user to enable/disable this, we
> could have a menu option for that in the View menu. Should we ?)

This has been turned on and off repeatedly over the years. I think the
main problem is that some people have quite long scripts for which the
line numbers start to take up a lot of room. I wouldn't be opposed to
making it a configurable option though... but many of the options in
the query tool actually affect other instances of the styled text
control as well. I wonder if now is the time to think about moving
them to the main options dialogue?


--
Dave Page
EnterpriseDB UK Ltd: http://www.enterprisedb.com
PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk

Attachment

Re: Display line numbers in SQL view

From
"Dave Page"
Date:
On Sat, Mar 15, 2008 at 2:43 AM, Robins Tharakan <tharakan@gmail.com> wrote:
> Hi Dave,
>
> True. In that case moving it as an option (with sane defaults) did seem like
> a better way. So attached is a reworked patch that puts two options in
> frmOptions.
>
> 1. A checkbox (in preferences tab) that applies to line numbers universally.
> 2. One checkbox (in the Query tab) specific to the SQL Query window.
>
> The defaults ensure that the we maintain status quo (i.e. Line numbers are
> enabled for Functions/Triggers but disabled for Query window).

Hmm, sorry, that still irks me. How about we just have 2 independent
options, one for dialogues, and one for windows (the query tool and
debugger)? We have various other options actually on the Query Tool
(because it can be run standalone), so the window option should
probably be included there as well.

Unless you want to incorporate this change into a wider change to move
all options onto frmOptions, and allow the appropriate parts of that
to be access from the Query Tool? That's what I'd like to see if you
want to work on it.


--
Dave Page
EnterpriseDB UK Ltd: http://www.enterprisedb.com
PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk