Thread: TODO item: Have psql show current values for a sequence

TODO item: Have psql show current values for a sequence

From
"Dickson S. Guedes"
Date:
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-hackers/2007-12/msg00102.php
http://archives.postgresql.org/pgsql-hackers/2007-12/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

Re: TODO item: Have psql show current values for a sequence

From
daveg
Date:
On Sat, May 24, 2008 at 12:27:16AM -0300, Dickson S. Guedes wrote:
> Hi all,
>
> These patch implements the TODO item: Have psql show current values
> for a sequence.
> Comments are welcome.
>
>           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                   |
> +---------------+---------+---------------------+

Is it now the style to draw a complete box around /d* displays? Or can we
dispense with the top and bottom rows of dashes?

-dg

--
David Gould       daveg@sonic.net      510 536 1443    510 282 0869
If simplicity worked, the world would be overrun with insects.

Re: TODO item: Have psql show current values for a sequence

From
"Dickson S. Guedes"
Date:
On Sat, May 24, 2008 at 2:25 AM, daveg <daveg@sonic.net> wrote:
> On Sat, May 24, 2008 at 12:27:16AM -0300, Dickson S. Guedes wrote:
>> Hi all,
>>
>> These patch implements the TODO item: Have psql show current values
>> for a sequence.
>> Comments are welcome.
>>
>>           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                   |
>> +---------------+---------+---------------------+
>
> Is it now the style to draw a complete box around /d* displays? Or can we
> dispense with the top and bottom rows of dashes?

Hi Dave,

This box around the display is because I'm using \pset border 2.

--
[]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/

Re: TODO item: Have psql show current values for a sequence

From
"Dickson S. Guedes"
Date:
On Sat, May 24, 2008 at 12:27 AM, Dickson S. Guedes <guediz@gmail.com> wrote:
> Hi all,
>
> These patch implements the TODO item: Have psql show current values
> for a sequence.

Hi all,

There are some comments or suggestions about this patch?

Thanks all.
--
[]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/