Re: proposal or just idea for psql - show first N rows from relation backslash statement

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
Thread:
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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2013-02-14 01:48:16 Re: Fractal tree indexing
Previous Message Tom Lane 2013-02-13 23:44:23 Re: proposal or just idea for psql - show first N rows from relation backslash statement