Unix Technical Forum

Re: TODO item: Have psql show current values for asequence

This is a discussion on Re: TODO item: Have psql show current values for asequence within the pgsql Hackers forums, part of the PostgreSQL category; --> Wow. I adjusted the patch slightly and applied it; the updated version is attached. We have been waiting for ...


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 07-18-2008, 09:50 AM
Bruce Momjian
 
Posts: n/a
Default Re: TODO item: Have psql show current values for asequence


Wow. I adjusted the patch slightly and applied it; the updated version
is attached. We have been waiting for this to be done for quite some
time. Thanks.

---------------------------------------------------------------------------


Dickson S. Guedes wrote:
> Hi all,
>
> These patch implements the TODO item: Have psql show current values
> for a sequence.
> Comments are welcome.
>
> * Credits
>
> The original patch were developed by Euler Taveira de Oliveira
> <euler@timbira.com>
> but how he is a little busy, he sends it to me and I made some changes
> to satisfy
> the TODO item above.
>
> * Discussions
>
> http://archives.postgresql.org/pgsql...2/msg00102.php
> http://archives.postgresql.org/pgsql...2/msg00605.php
>
> * Outputs
>
> # \d foo_bar_seq
> Sequence "public.foo_bar_seq"
> +---------------+---------+---------------------+
> | Column | Type | Value |
> +---------------+---------+---------------------+
> | sequence_name | name | foo_bar_seq |
> | last_value | bigint | 11 |
> | start_value | bigint | 1 |
> | increment_by | bigint | 1 |
> | max_value | bigint | 9223372036854775807 |
> | min_value | bigint | 1 |
> | cache_value | bigint | 1 |
> | log_cnt | bigint | 31 |
> | is_cycled | boolean | f |
> | is_called | boolean | t |
> +---------------+---------+---------------------+
>
> # \d+ foo_bar_seq
> Sequence "public.foo_bar_seq"
> +---------------+---------+---------------------+-------------+
> | Column | Type | Value | Description |
> +---------------+---------+---------------------+-------------+
> | sequence_name | name | foo_bar_seq | |
> | last_value | bigint | 11 | |
> | start_value | bigint | 1 | |
> | increment_by | bigint | 1 | |
> | max_value | bigint | 9223372036854775807 | |
> | min_value | bigint | 1 | |
> | cache_value | bigint | 1 | |
> | log_cnt | bigint | 31 | |
> | is_cycled | boolean | f | |
> | is_called | boolean | t | |
> +---------------+---------+---------------------+-------------+
>
> --
> []s
> Dickson S. Guedes
> --------------------------------------
> Projeto Colmeia - Curitiba - PR
> +55 (41) 3254-7130 ramal: 27
> http://makeall.wordpress.com/
> http://pgcon.postgresql.org.br/
> http://planeta.postgresql.org.br/


[ Attachment, skipping... ]

>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers


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

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


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-22-2008, 06:58 AM
Tom Lane
 
Posts: n/a
Default Re: TODO item: Have psql show current values for a sequence

Bruce Momjian <bruce@momjian.us> writes:
> Wow. I adjusted the patch slightly and applied it; the updated version
> is attached. We have been waiting for this to be done for quite some
> time. Thanks.


Hmm ... I don't think that this patch actually addresses the TODO item.
The TODO item seems to have originated here
http://anoncvs.postgresql.org/cvsweb...;r2=1.1221;f=h
in response to this question on pgsql-novice:

> How can I list all the sequences in the database, with their
> attributes (such as last_value)? (I'm having a hard time guessing
> 'seq-name'; the 'A_id_seq' formula did not work.)

http://archives.postgresql.org/pgsql...2/msg00148.php

This applied-with-little-discussion patch only shows the sequence
values if you do a \d on a specific sequence, or \d on a wildcard
that happens to include some sequences (and probably a lot of other
stuff too, causing the resulting display to be far too long to be
useful).

My interpretation of the TODO item has always been that we should
improve \ds to include all the useful information in a format that
requires only one line per sequence. The reason it has remained
undone for four years is that that's hard given the existing catalog
representation of sequences and the constraints of describe.c's
implementation. (I recall at least one failed patch that tried to
do this, though I can't find it in the archives right now.)

I find the present patch to be pretty useless: it's not a material
advance over doing "select * from sequence-name". I think it should
be reverted and the TODO item reinstated --- perhaps with more detail
about what the item really is requesting.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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 12:32 AM.


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