Lists: | pgsql-hackers |
---|
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:07:54 |
Message-ID: | CAFj8pRCeE5TzW-2WcCHpJtf1CbPQ4E_PauLW1x9QS7MWgxn-Pg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hello
probably one from my top ten SQL statement will be
SELECT * FROM some_relation LIMIT 10
what do you thinking about creating special statement for this purpose?
possible syntax
-- ViewTable
\vt table_name [rows]
or
\sample table_name [rows]
a implementation with autocomplete is terrible simple
Regards
Pavel
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:23:31 |
Message-ID: | 20130213202331.GQ16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> SELECT * FROM some_relation LIMIT 10
>
> what do you thinking about creating special statement for this purpose?
I'd rather extend TABLE to support a limit clause or something.
Thanks,
Stephen
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:30:58 |
Message-ID: | CAFj8pRDPfkggN9gpkQamhfYrMOGpdaRBMjABBvswer2gXa5w9g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/13 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> SELECT * FROM some_relation LIMIT 10
>>
>> what do you thinking about creating special statement for this purpose?
>
> I'd rather extend TABLE to support a limit clause or something.
??
Pavel
>
> Thanks,
>
> Stephen
From: | "Erik Rijkers" <er(at)xs4all(dot)nl> |
---|---|
To: | "Stephen Frost" <sfrost(at)snowman(dot)net> |
Cc: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:41:59 |
Message-ID: | 2417d015e66a3a7921d385aecfd0f57c.squirrel@webmail.xs4all.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, February 13, 2013 21:23, Stephen Frost wrote:
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> SELECT * FROM some_relation LIMIT 10
>>
>> what do you thinking about creating special statement for this purpose?
>
> I'd rather extend TABLE to support a limit clause or something.
>
No need; that already does work, e.g.:
testdb=# table pg_database limit 3;
Not in the documentation, but I hope it won't get removed -- it's quite handy
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Erik Rijkers <er(at)xs4all(dot)nl> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:44:24 |
Message-ID: | 20130213204424.GS16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Erik Rijkers (er(at)xs4all(dot)nl) wrote:
> No need; that already does work, e.g.:
>
> testdb=# table pg_database limit 3;
Oh.
> Not in the documentation, but I hope it won't get removed -- it's quite handy
Perhaps we should add it. :)
Thanks!
Stephen
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Erik Rijkers <er(at)xs4all(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:48:00 |
Message-ID: | CAFj8pRA-FV80eNfeYGMaBhwp76tywaS8br5YFW1Bu6_pk3sPZA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/13 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Erik Rijkers (er(at)xs4all(dot)nl) wrote:
>> No need; that already does work, e.g.:
>>
>> testdb=# table pg_database limit 3;
>
> Oh.
>
>> Not in the documentation, but I hope it won't get removed -- it's quite handy
>
> Perhaps we should add it. :)
my proposal is little but shorter
just
\vt table
and I expect so limit 10 is default
table statement is little bit different creature (and mainly it is server side)
Regards
Pavel
>
> Thanks!
>
> Stephen
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Erik Rijkers <er(at)xs4all(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 20:51:00 |
Message-ID: | 20130213205100.GT16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> and I expect so limit 10 is default
>
> table statement is little bit different creature (and mainly it is server side)
I don't really see the value in this.
Thanks,
Stephen
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Erik Rijkers <er(at)xs4all(dot)nl>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 21:02:12 |
Message-ID: | CAFj8pRAZgt__YNxQeVPDReBM5y-HaUX07q1b++Viz-NtcKwJGw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/13 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> and I expect so limit 10 is default
>>
>> table statement is little bit different creature (and mainly it is server side)
>
> I don't really see the value in this.
it is just shortcut for often used query - nothing more
and with larger tables you don't need to forget LIMIT clause
Regards
Pavel
>
> Thanks,
>
> Stephen
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 21:25:19 |
Message-ID: | 16696.1360790719@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Stephen Frost <sfrost(at)snowman(dot)net> writes:
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> SELECT * FROM some_relation LIMIT 10
>>
>> what do you thinking about creating special statement for this purpose?
> I'd rather extend TABLE to support a limit clause or something.
Can't you pretty much do this already in psql with FETCH_COUNT? I see
no good reason to invent more SQL syntax.
regards, tom lane
From: | Ian Lawrence Barwick <barwick(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 23:34:42 |
Message-ID: | CAB8KJ=jygrAPxwtOH9S3ED+6m9LdsZLWZiOGg51U4hzBiG=JzQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/14 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Stephen Frost <sfrost(at)snowman(dot)net> writes:
>> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>>> SELECT * FROM some_relation LIMIT 10
>>>
>>> what do you thinking about creating special statement for this purpose?
>
>> I'd rather extend TABLE to support a limit clause or something.
>
> Can't you pretty much do this already in psql with FETCH_COUNT? I see
> no good reason to invent more SQL syntax.
Doesn't that just split up the retrieval of the result set into blocks of
FETCH_COUNT rows, i.e. does not limit the result set?
Personally I set commonly-used queries as a psql variable, though
what Pavel suggests sounds useful and AFAICT is not additional SQL
syntax, just (yet another) psql slash command.
Ian Barwick
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Ian Lawrence Barwick <barwick(at)gmail(dot)com> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-13 23:44:23 |
Message-ID: | 19631.1360799063@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Ian Lawrence Barwick <barwick(at)gmail(dot)com> writes:
> 2013/2/14 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>> Can't you pretty much do this already in psql with FETCH_COUNT? I see
>> no good reason to invent more SQL syntax.
> Doesn't that just split up the retrieval of the result set into blocks of
> FETCH_COUNT rows, i.e. does not limit the result set?
Well, you'll get a page worth of data before your pager blocks it,
and then you can continue, or not, for relatively little cost.
I can't see that fetching a fixed number of rows is more useful
than that.
[ experiments... ] Although I notice that psql's FETCH_COUNT logic
doesn't realize that it could be applied to a "TABLE foo" query.
That seems like it might be worth fixing.
regards, tom lane
From: | Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 00:16:21 |
Message-ID: | CAFcNs+rHYDnp2aiMJs8i2Br=y+jygxKYWCTcrutv-RSCG+i_HQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Wed, Feb 13, 2013 at 6:07 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>wrote:
> Hello
>
> probably one from my top ten SQL statement will be
>
> SELECT * FROM some_relation LIMIT 10
>
> what do you thinking about creating special statement for this purpose?
>
> possible syntax
>
> -- ViewTable
> \vt table_name [rows]
>
> or
>
> \sample table_name [rows]
>
> a implementation with autocomplete is terrible simple
>
>
I liked this idea, but thinking better we can implement a way to users
create your own meta-commands to run:
* another meta commands (like an alias)
* SRFs
* arbitrary SQLs
All of them must accept arguments... some like this:
\mset vt :table :rows 'select * from :table limit :rows'
Then we can do exactly what you need:
\vt foo 10
\unset vt
I don't know if it's a desired feature but I would love if it exists.
Best regards,
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | fabriziomello(at)gmail(dot)com |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 07:25:27 |
Message-ID: | CAFj8pRBjTwsXx4KfzFJW-D0-KnwntW2mgypR6LexGsch5ML8Yw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Hello
>
>
> I liked this idea, but thinking better we can implement a way to users
> create your own meta-commands to run:
>
> * another meta commands (like an alias)
> * SRFs
> * arbitrary SQLs
>
> All of them must accept arguments... some like this:
>
> \mset vt :table :rows 'select * from :table limit :rows'
>
> Then we can do exactly what you need:
>
> \vt foo 10
>
> \unset vt
>
> I don't know if it's a desired feature but I would love if it exists.
>
few year ago I proposed a implementation of macros - and I wrote a
prototype - enhanced psql
http://okbob.blogspot.cz/search?q=epsql
but now I don't think so enhancing psql in this direction is good way.
Enhanced console needs creating from scratch - it should be based on
some interpret language - LUA or javascript - probably it can be
better integrated to modern UI, can better do autocomplete - and this
design is out of my time possibilities and out of my targets.
Native implementation of \vt is terrible simple - and it is generic
and usual task
check it, please
Regards
Pavel
p.s. some simple form of bash alias command can be implemented, but
probably without autocomplete support
p.s.2. inside quotes or double quotes variables substitution doesn't work
> Best regards,
>
> --
> Fabrízio de Royes Mello
> Consultoria/Coaching PostgreSQL
>>> Blog sobre TI: http://fabriziomello.blogspot.com
>>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>>> Twitter: http://twitter.com/fabriziomello
Attachment | Content-Type | Size |
---|---|---|
vt.patch | application/octet-stream | 2.4 KB |
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 13:31:49 |
Message-ID: | 20130214133149.GU16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> Native implementation of \vt is terrible simple - and it is generic
> and usual task
I'm still a -1 on this. We don't have anything like this today and I
don't think it's a good idea to try adding these kinds of
shortcuts-for-generic-SQL to psql's set of \ commands. Being simple to
implement doesn't make it a good idea.
Thanks,
Stephen
From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:24:35 |
Message-ID: | CAHyXU0xUnHsOu3oh0G2yjwCdoLVmBMkCo0e3GwgnX1a0XaN5gg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Feb 14, 2013 at 1:25 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> few year ago I proposed a implementation of macros - and I wrote a
> prototype - enhanced psql
>
> http://okbob.blogspot.cz/search?q=epsql
>
> but now I don't think so enhancing psql in this direction is good way.
> Enhanced console needs creating from scratch - it should be based on
> some interpret language - LUA or javascript - probably it can be
> better integrated to modern UI, can better do autocomplete - and this
> design is out of my time possibilities and out of my targets.
The main argument against psql macros II guess is that if you want
bash like features, well, use bash.
For my part I think that whenever psql enhancements are brought up the
first think to consider is 'should this functionality exist on the
server side'. With proper stored procedures we get to write our own
stuff like:
CALL top10('foo');
which seems more general and just as terse. So I think implementing
call syntax is probably topping my 'wanted feature' list.
merlin
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:33:51 |
Message-ID: | 20130214143351.GX16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
> CALL top10('foo');
>
> which seems more general and just as terse. So I think implementing
> call syntax is probably topping my 'wanted feature' list.
We have that, it's called 'SELECT' and it's only 2 more characters..
Thanks,
Stephen
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:33:58 |
Message-ID: | CAFj8pRCgSzJ8ScrA8baTHiagu8DA40s8=kgLbNgxNamJcYExdA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/14 Merlin Moncure <mmoncure(at)gmail(dot)com>:
> On Thu, Feb 14, 2013 at 1:25 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> few year ago I proposed a implementation of macros - and I wrote a
>> prototype - enhanced psql
>>
>> http://okbob.blogspot.cz/search?q=epsql
>>
>> but now I don't think so enhancing psql in this direction is good way.
>> Enhanced console needs creating from scratch - it should be based on
>> some interpret language - LUA or javascript - probably it can be
>> better integrated to modern UI, can better do autocomplete - and this
>> design is out of my time possibilities and out of my targets.
>
> The main argument against psql macros II guess is that if you want
> bash like features, well, use bash.
>
> For my part I think that whenever psql enhancements are brought up the
> first think to consider is 'should this functionality exist on the
> server side'. With proper stored procedures we get to write our own
> stuff like:
>
> CALL top10('foo');
>
> which seems more general and just as terse. So I think implementing
> call syntax is probably topping my 'wanted feature' list.
My proposal should not replace stored procedures.
The core of my proposal was using autocomplete for one often task.
>
> merlin
From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:36:55 |
Message-ID: | 20130214143655.GB4330@awork2.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On 2013-02-14 09:33:51 -0500, Stephen Frost wrote:
> * Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
> > CALL top10('foo');
> >
> > which seems more general and just as terse. So I think implementing
> > call syntax is probably topping my 'wanted feature' list.
>
> We have that, it's called 'SELECT' and it's only 2 more characters..
Well, I guess Merlin wanted actual stored procedures with full control
over transactions... Not exactly a small task.
Greetings,
Andres Freund
--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:37:10 |
Message-ID: | CAFj8pRBPCdso6Q80B8_AHNGWKBpwpDNiu3exCVgsPvxJc6yEKg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/14 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
>> CALL top10('foo');
>>
>> which seems more general and just as terse. So I think implementing
>> call syntax is probably topping my 'wanted feature' list.
>
> We have that, it's called 'SELECT' and it's only 2 more characters..
it is not true
SELECT * FROM foo LIMIT 10 -- 26 chars
CALL top('foo') -- 15 chars
\vt foo -- 7 chars
Regards
Pavel
>
> Thanks,
>
> Stephen
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:41:39 |
Message-ID: | 20130214144139.GY16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> it is not true
It most certainly is true- did you look at the command?
SELECT top10('foo');
Note that it's "top10", implying that it'd return the first 10 records.
That's only 2 characters more than:
CALL top10('foo');
It's not as short as '\vt foo', but I never claimed that it was, nor do
I feel it's particularly valuable to shorten it down to that level.
Thanks,
Stephen
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 14:43:34 |
Message-ID: | 20130214144333.GZ16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> My proposal should not replace stored procedures.
Stored procedures, with actual transaction-management capabilities, is a
completely different topic which isn't usefully involved here.
> The core of my proposal was using autocomplete for one often task.
TABLE already supports tab-completion.
Thanks,
Stephen
From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 15:34:42 |
Message-ID: | 20130214153442.GD4747@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Pavel Stehule escribió:
> 2013/2/14 Stephen Frost <sfrost(at)snowman(dot)net>:
> > * Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
> >> CALL top10('foo');
> >>
> >> which seems more general and just as terse. So I think implementing
> >> call syntax is probably topping my 'wanted feature' list.
> >
> > We have that, it's called 'SELECT' and it's only 2 more characters..
>
> it is not true
>
> SELECT * FROM foo LIMIT 10 -- 26 chars
>
> CALL top('foo') -- 15 chars
>
> \vt foo -- 7 chars
table foo limit 10; -- can be ta<tab>, saves 4 keystrokes
Needs autocompletion for "limit", then it's 8 keystrokes plus table
name, no extraneous features needed.
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 15:52:05 |
Message-ID: | CAHyXU0xMxF-O0J6_xuiK_p5ZfK2kKWjXCG6vktXW_cL5xFN7pg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Feb 14, 2013 at 8:43 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> My proposal should not replace stored procedures.
>
> Stored procedures, with actual transaction-management capabilities, is a
> completely different topic which isn't usefully involved here.
>
>> The core of my proposal was using autocomplete for one often task.
>
> TABLE already supports tab-completion.
TABLE is fine. My point is that often when discussing extensions to
psql are we really working around lack of stored procedures. Talk of
stored procedures is not off topic, because they could directly
implement proposed $feature in a much more general way. I am very
sanguine about implementation difficulties but please don't shoot the
messenger.
> SELECT top10('foo');
That doesn't work. functions don't allow arbitrary returned columns.
CALL should support this.
Anyways, if we are counting characters,
TA<tab> fo<tab> limit 10; < 17
CA<tab> to<tab>('foo'); < 15 (but different table name could
certainly swing it)
merlin
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 16:03:10 |
Message-ID: | 20130214160310.GA16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
> That doesn't work. functions don't allow arbitrary returned columns.
> CALL should support this.
That's yet another discussion, though for a preview, you could just
return a single text column from the function in which you do whatever
formatting you want.
Thanks,
Stephen
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 16:32:07 |
Message-ID: | CAFj8pRB5VyRt9BwfNooLjzNpSkc9hWmQy+zHNOiXmrEXRLG_Gg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/14 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>> it is not true
>
> It most certainly is true- did you look at the command?
>
> SELECT top10('foo');
>
> Note that it's "top10", implying that it'd return the first 10 records.
> That's only 2 characters more than:
In current implementation you need a a polymorphic function
and then you have to write
SELECT (top10('foo')).*
or
SELECT * FROM top10('foo')
Regards
Pavel
>
> CALL top10('foo');
>
> It's not as short as '\vt foo', but I never claimed that it was, nor do
> I feel it's particularly valuable to shorten it down to that level.
>
> Thanks,
>
> Stephen
From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 16:35:30 |
Message-ID: | CAFj8pRA9Sh245evODc8-2h01KmVWuCOxMYKhzs6K=+KmK1kMEQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
2013/2/14 Stephen Frost <sfrost(at)snowman(dot)net>:
> * Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
>> That doesn't work. functions don't allow arbitrary returned columns.
>> CALL should support this.
>
> That's yet another discussion, though for a preview, you could just
> return a single text column from the function in which you do whatever
> formatting you want.
it is not easy - we have no available any formatting support on server side
so then you need to supply lot of libpq code
Pavel
>
> Thanks,
>
> Stephen
From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 16:41:20 |
Message-ID: | 20130214164120.GB16126@tamriel.snowman.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
* Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
> it is not easy - we have no available any formatting support on server side
Sure we do.
> so then you need to supply lot of libpq code
No, you don't.
This discussion isn't going to change my feelings on this particular
misfeature. If others feel it's valuable and important then they can
certainly speak-up.
Thanks,
Stephen
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 16:49:53 |
Message-ID: | 23156.1360860593@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Stephen Frost <sfrost(at)snowman(dot)net> writes:
> This discussion isn't going to change my feelings on this particular
> misfeature. If others feel it's valuable and important then they can
> certainly speak-up.
I think the same --- a new backslash command for this is absolutely not
worth its weight compared to using "TABLE foo".
We have identified at least two places where psql could be improved to
support the use of "TABLE foo" better, without adding any new syntax
(viz, teach the FETCH_COUNT logic about it and improve tab-completion
to know about the possibility of limit/offset clauses). I think that's
a much more sensible path to pursue than inventing more "features".
regards, tom lane
From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 17:44:33 |
Message-ID: | CAHyXU0xWb9xK3Bs_AnpVYuB7z+dvkon-VPBmVz6ehooSY4yJuA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Feb 14, 2013 at 10:32 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2013/2/14 Stephen Frost <sfrost(at)snowman(dot)net>:
>> * Pavel Stehule (pavel(dot)stehule(at)gmail(dot)com) wrote:
>>> it is not true
>>
>> It most certainly is true- did you look at the command?
>>
>> SELECT top10('foo');
>>
>> Note that it's "top10", implying that it'd return the first 10 records.
>> That's only 2 characters more than:
>
> In current implementation you need a a polymorphic function
>
> and then you have to write
>
> SELECT (top10('foo')).*
>
> or
>
> SELECT * FROM top10('foo')
that can't work either -- at least not without a column select list.
there has to be some clue to output time from arguments to the
function.
merlin
From: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, fabriziomello(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal or just idea for psql - show first N rows from relation backslash statement |
Date: | 2013-02-14 17:45:43 |
Message-ID: | CAHyXU0xp_9BhwjkW0cYLToMAr9_4wB=C42YOsGrpH2ag7gayxw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Thu, Feb 14, 2013 at 10:03 AM, Stephen Frost <sfrost(at)snowman(dot)net> wrote:
> * Merlin Moncure (mmoncure(at)gmail(dot)com) wrote:
>> That doesn't work. functions don't allow arbitrary returned columns.
>> CALL should support this.
>
> That's yet another discussion, though for a preview, you could just
> return a single text column from the function in which you do whatever
> formatting you want.
sure -- I use this technique often although lately i've moved from
text to hstore/json.
merlin