Обсуждение: Solution proposal for TODO item "Clients: sequences"

Поиск
Список
Период
Сортировка

Solution proposal for TODO item "Clients: sequences"

От
"Gevik Babakhani"
Дата:
Dear People,

Hereby a proposal for the TODO item "Clients: Have psql show current values
for a sequences".
I have added a new slash command to psql client "\sq" for showing the last
values of the 
existing sequences in the public schema. The code is only tested on rh9.

The new files are sequence_info.c and sequence_info.h I would like 
to hear your comments. (Be gentle this is my first)

The sources can be downloaded from http://www.truesoftware.net/psql/

Regards,
Gevik


----------------------------------------------------------------
SCREEN OUTPUT
----------------------------------------------------------------
[gevik@voyager psql]$ ./psql
Welcome to psql 8.0.0beta5, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms      \h for help with SQL commands      \? for help with psql commands      \g
orterminate with semicolon to execute query      \q to quit
 

gevik=# \sq
Current sequence valuesSequence  | Last value
-----------+------------mytableid |          5seq1      |          1
(2 rows)

gevik=#



Re: Solution proposal for TODO item "Clients: sequences"

От
Bruce Momjian
Дата:
That would be something good for 8.1 so I will keep your email.

This has been saved for the 8.1 release:
http:/momjian.postgresql.org/cgi-bin/pgpatches2

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

Gevik Babakhani wrote:
> Dear People,
> 
> Hereby a proposal for the TODO item "Clients: Have psql show current values
> for a sequences".
> I have added a new slash command to psql client "\sq" for showing the last
> values of the 
> existing sequences in the public schema. The code is only tested on rh9.
> 
> The new files are sequence_info.c and sequence_info.h I would like 
> to hear your comments. (Be gentle this is my first)
> 
> The sources can be downloaded from http://www.truesoftware.net/psql/
> 
> Regards,
> Gevik
> 
> 
> ----------------------------------------------------------------
> SCREEN OUTPUT
> ----------------------------------------------------------------
> [gevik@voyager psql]$ ./psql
> Welcome to psql 8.0.0beta5, the PostgreSQL interactive terminal.
> 
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
> 
> gevik=# \sq
> Current sequence values
>  Sequence  | Last value
> -----------+------------
>  mytableid |          5
>  seq1      |          1
> (2 rows)
> 
> gevik=#
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Solution proposal for TODO item "Clients: sequences"

От
Bruce Momjian
Дата:
It would be nice to add the current sequence value to \ds, but the
existing psql query would have to be overhauled to do that.  Right now
the same query does all the work for most \d commands.

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

Gevik Babakhani wrote:
> Dear People,
> 
> Hereby a proposal for the TODO item "Clients: Have psql show current values
> for a sequences".
> I have added a new slash command to psql client "\sq" for showing the last
> values of the 
> existing sequences in the public schema. The code is only tested on rh9.
> 
> The new files are sequence_info.c and sequence_info.h I would like 
> to hear your comments. (Be gentle this is my first)
> 
> The sources can be downloaded from http://www.truesoftware.net/psql/
> 
> Regards,
> Gevik
> 
> 
> ----------------------------------------------------------------
> SCREEN OUTPUT
> ----------------------------------------------------------------
> [gevik@voyager psql]$ ./psql
> Welcome to psql 8.0.0beta5, the PostgreSQL interactive terminal.
> 
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
> 
> gevik=# \sq
> Current sequence values
>  Sequence  | Last value
> -----------+------------
>  mytableid |          5
>  seq1      |          1
> (2 rows)
> 
> gevik=#
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: Solution proposal for TODO item "Clients: sequences"

От
"Gevik babakhani"
Дата:
So what would be your suggestion in order to add this functionality?


-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Bruce Momjian
Sent: Sunday, June 05, 2005 3:17 AM
To: Gevik Babakhani
Cc: Pgsql-Hackers@Postgresql. Org
Subject: Re: [HACKERS] Solution proposal for TODO item "Clients: sequences"


It would be nice to add the current sequence value to \ds, but the
existing psql query would have to be overhauled to do that.  Right now
the same query does all the work for most \d commands.

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

Gevik Babakhani wrote:
> Dear People,
> 
> Hereby a proposal for the TODO item "Clients: Have psql show current
values
> for a sequences".
> I have added a new slash command to psql client "\sq" for showing the last
> values of the 
> existing sequences in the public schema. The code is only tested on rh9.
> 
> The new files are sequence_info.c and sequence_info.h I would like 
> to hear your comments. (Be gentle this is my first)
> 
> The sources can be downloaded from http://www.truesoftware.net/psql/
> 
> Regards,
> Gevik
> 
> 
> ----------------------------------------------------------------
> SCREEN OUTPUT
> ----------------------------------------------------------------
> [gevik@voyager psql]$ ./psql
> Welcome to psql 8.0.0beta5, the PostgreSQL interactive terminal.
> 
> Type:  \copyright for distribution terms
>        \h for help with SQL commands
>        \? for help with psql commands
>        \g or terminate with semicolon to execute query
>        \q to quit
> 
> gevik=# \sq
> Current sequence values
>  Sequence  | Last value
> -----------+------------
>  mytableid |          5
>  seq1      |          1
> (2 rows)
> 
> gevik=#
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your     joining column's datatypes do not match



Re: Solution proposal for TODO item "Clients: sequences"

От
"Jonah H. Harris"
Дата:
I would suggest adding it to \ds or create a \ds+ so that it is in 
common with the rest of the commands.

-Jonah


Gevik babakhani wrote:

>So what would be your suggestion in order to add this functionality?
>
>
>-----Original Message-----
>From: pgsql-hackers-owner@postgresql.org
>[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Bruce Momjian
>Sent: Sunday, June 05, 2005 3:17 AM
>To: Gevik Babakhani
>Cc: Pgsql-Hackers@Postgresql. Org
>Subject: Re: [HACKERS] Solution proposal for TODO item "Clients: sequences"
>
>
>It would be nice to add the current sequence value to \ds, but the
>existing psql query would have to be overhauled to do that.  Right now
>the same query does all the work for most \d commands.
>
>---------------------------------------------------------------------------
>
>Gevik Babakhani wrote:
>  
>
>>Dear People,
>>
>>Hereby a proposal for the TODO item "Clients: Have psql show current
>>    
>>
>values
>  
>
>>for a sequences".
>>I have added a new slash command to psql client "\sq" for showing the last
>>values of the 
>>existing sequences in the public schema. The code is only tested on rh9.
>>
>>The new files are sequence_info.c and sequence_info.h I would like 
>>to hear your comments. (Be gentle this is my first)
>>
>>The sources can be downloaded from http://www.truesoftware.net/psql/
>>
>>Regards,
>>Gevik
>>
>>
>>----------------------------------------------------------------
>>SCREEN OUTPUT
>>----------------------------------------------------------------
>>[gevik@voyager psql]$ ./psql
>>Welcome to psql 8.0.0beta5, the PostgreSQL interactive terminal.
>>
>>Type:  \copyright for distribution terms
>>       \h for help with SQL commands
>>       \? for help with psql commands
>>       \g or terminate with semicolon to execute query
>>       \q to quit
>>
>>gevik=# \sq
>>Current sequence values
>> Sequence  | Last value
>>-----------+------------
>> mytableid |          5
>> seq1      |          1
>>(2 rows)
>>
>>gevik=#
>>
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 6: Have you searched our list archives?
>>
>>               http://archives.postgresql.org
>>
>>    
>>
>
>  
>