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

From Fabrízio de Royes Mello
Subject Re: proposal or just idea for psql - show first N rows from relation backslash statement
Date
Msg-id CAFcNs+rHYDnp2aiMJs8i2Br=y+jygxKYWCTcrutv-RSCG+i_HQ@mail.gmail.com
Whole thread Raw
In response to proposal or just idea for psql - show first N rows from relation backslash statement  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: proposal or just idea for psql - show first N rows from relation backslash statement  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers


On Wed, Feb 13, 2013 at 6:07 PM, Pavel Stehule <pavel.stehule@gmail.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

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: proposal or just idea for psql - show first N rows from relation backslash statement
Next
From: Greg Stark
Date:
Subject: Re: Fractal tree indexing