Unix Technical Forum

psql's describe command (for sequences) output improvement

This is a discussion on psql's describe command (for sequences) output improvement within the pgsql Hackers forums, part of the PostgreSQL category; --> Hi all, I have a patch which tries to improve the '\d some_sequence_name' command output in psql utility. Before ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 10:35 PM
Aftab Hussain
 
Posts: n/a
Default psql's describe command (for sequences) output improvement


Hi all,

I have a patch which tries to improve the '\d some_sequence_name' command output in psql utility. Before sending the patch to pgsql-patches I just want to know your opinion whether the new output of the command is OK or it needs to be modified before sending it to pgsql-patches.

For comparison purpose, here is the output of the '\d some_sequence_name' command:

-- Say we have created a sequence named 'test_seq' already as CREATE SEQUENCE test_seq.

--
-- Output: before applying the patch.
--
testdb=# \d test_seq;
Sequence "public.test_seq"
Column | Type
---------------+---------
sequence_name | name
last_value | bigint
increment_by | bigint
max_value | bigint
min_value | bigint
cache_value | bigint
log_cnt | bigint
is_cycled | boolean
is_called | boolean

--
-- Output: after applying the patch.
--
testdb=# \d test_seq;
Sequence "public.test_seq"
last_value | increment_by | max_value | min_value | cache_value | log_cnt | is_cycled | is_called
------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
1 | 1 | 9223372036854775807 | 1 | 1 | 1 | f | f



Thanks in advance for your feedback(s).

--
Aftab.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 10:35 PM
Peter Childs
 
Posts: n/a
Default Re: psql's describe command (for sequences) output improvement

On 04/12/2007, Aftab Hussain <aftab.hussain@enterprisedb.com> wrote:
>
>
> Hi all,
>
> I have a patch which tries to improve the '\d some_sequence_name' command
> output in psql utility. Before sending the patch to pgsql-patches I just
> want to know your opinion whether the new output of the command is OK or it
> needs to be modified before sending it to pgsql-patches.
>
> For comparison purpose, here is the output of the '\d some_sequence_name'
> command:
>
> -- Say we have created a sequence named 'test_seq' already as CREATE
> SEQUENCE test_seq.
>
> --
> -- Output: before applying the patch.
> --
> testdb=# \d test_seq;
> Sequence "public.test_seq"
> Column | Type
> ---------------+---------
> sequence_name | name
> last_value | bigint
> increment_by | bigint
> max_value | bigint
> min_value | bigint
> cache_value | bigint
> log_cnt | bigint
> is_cycled | boolean
> is_called | boolean
>
> --
> -- Output: after applying the patch.
> --
> testdb=# \d test_seq;
> Sequence "public.test_seq"
> last_value | increment_by | max_value | min_value | cache_value
> | log_cnt | is_cycled | is_called
>
> ------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
> 1 | 1 | 9223372036854775807 | 1 | 1
> | 1 | f | f
>
>
>
> Thanks in advance for your feedback(s).
>
> --
> Aftab.
>

Why?

is that not what

select * from test_seq;

does already.

\d command return meta data not data.

Peter Childs

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-15-2008, 10:36 PM
Aftab Hussain
 
Posts: n/a
Default Re: psql's describe command (for sequences) output improvement

On Dec 4, 2007 7:47 PM, Peter Childs <peterachilds@gmail.com> wrote:

>
>
> On 04/12/2007, Aftab Hussain <aftab.hussain@enterprisedb.com> wrote:
> >
> >
> > Hi all,
> >
> > I have a patch which tries to improve the '\d some_sequence_name'
> > command output in psql utility. Before sending the patch to pgsql-patches I
> > just want to know your opinion whether the new output of the command is OK
> > or it needs to be modified before sending it to pgsql-patches.
> >
> > For comparison purpose, here is the output of the '\d
> > some_sequence_name' command:
> >
> > -- Say we have created a sequence named 'test_seq' already as CREATE
> > SEQUENCE test_seq.
> >
> > --
> > -- Output: before applying the patch.
> > --
> > testdb=# \d test_seq;
> > Sequence "public.test_seq"
> > Column | Type
> > ---------------+---------
> > sequence_name | name
> > last_value | bigint
> > increment_by | bigint
> > max_value | bigint
> > min_value | bigint
> > cache_value | bigint
> > log_cnt | bigint
> > is_cycled | boolean
> > is_called | boolean
> >
> > --
> > -- Output: after applying the patch.
> > --
> > testdb=# \d test_seq;
> > Sequence "public.test_seq"
> > last_value | increment_by | max_value | min_value |
> > cache_value | log_cnt | is_cycled | is_called
> >
> > ------------+--------------+---------------------+-----------+-------------+---------+-----------+-----------
> > 1 | 1 | 9223372036854775807 | 1 |
> > 1 | 1 | f | f
> >
> >
> >
> > Thanks in advance for your feedback(s).
> >
> > --
> > Aftab.
> >

> Why?
>
> is that not what
>
> select * from test_seq;
>
> does already.



>
> \d command return meta data not data.
>
> Peter Childs
>


In general, \d command is working perfectly for database objects.

For sequences, I think the current \d some_sequence command's output is
displaying information which does not help the end user very much. Also
isn't the newly display information (same as information provided by 'select
* from test_seq;' statement) is/can-be-considered the metadata information
about the sequences queried about (since for the returning sequences data we
have nextval('...'), currval('...') functions)?

Please correct me if I am wrong or have missed something.

Aftab Hussain.
EnterpriseDB. www.enterprisedb.com

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-15-2008, 10:37 PM
Bruce Momjian
 
Posts: n/a
Default Re: psql's describe command (for sequences) outputimprovement

Aftab Hussain wrote:
> In general, \d command is working perfectly for database objects.
>
> For sequences, I think the current \d some_sequence command's output is
> displaying information which does not help the end user very much. Also
> isn't the newly display information (same as information provided by 'select
> * from test_seq;' statement) is/can-be-considered the metadata information
> about the sequences queried about (since for the returning sequences data we
> have nextval('...'), currval('...') functions)?


Yes, you are kind of right that \d on sequences provides unhelpful
output, but having it display the sequence values seems odd. TODO has:

o Have psql show current values for a sequence

Maybe \d+ sequence_name should add a column that shows the current
values:

test=> \d+ x
Sequence "public.x"
Column | Type | Value | Description
---------------+---------+----------------------
sequence_name | name | x
last_value | bigint | 1
increment_by | bigint |
max_value | bigint |
min_value | bigint |
cache_value | bigint |
log_cnt | bigint |
is_cycled | boolean |
is_called | boolean |


--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:36 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com