geometry test failed (beta5 on Debian)

Started by Nonameabout 23 years ago5 messages
#1Noname
am@fx.ro

Hi all!

PostgreSQL 7.3 beta5
Debian GNU/Linux 2.2r5 ( x86 )
.............

All regression tests passed, except geometry.
The differences don't seem to be big. I think the test can be
validated, but i'm not absolutely sure. So i've attached the diff.

.............

On the other hand, in psql , tab-completion doesn't seem to
work for certain commands :

ALTER DATABASE ; ALTER TRIGGER ; CHECKPOINT ; CREATE CAST ;
CREATE CONSTRAINT TRIGGER ; CREATE CONVERSION ; CREATE DOMAIN ;
CREATE LANGUAGE ; DEALLOCATE ; DROP CAST ; DROP CONVERSION ;
DROP DOMAIN ; DROP LANGUAGE ; EXECUTE ; PREPARE

( this could be considered a low priority todo item , though )
.............

Regards,

Adrian Maier
(am@fx.ro)

#2Noname
am@fx.ro
In reply to: Noname (#1)
1 attachment(s)
Re: geometry test failed (beta5 on Debian)

On Tue, Nov 12, 2002 at 03:20:52AM +0200, am@fx.ro wrote:

validated, but i'm not absolutely sure. So i've attached the diff.

Oops , forgot to attach it in the first message.
This is the diff.

Attachments:

regression.diffstext/plain; charset=us-asciiDownload
*** ./expected/geometry.out	Thu Nov 29 20:57:31 2001
--- ./results/geometry.out	Tue Nov 12 02:08:46 2002
***************
*** 443,454 ****
     FROM CIRCLE_TBL;
   six |                                                                                                                                                                                           polygon                                                                                                                                                                                           
  -----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!      | ((-3,0),(-2.59807621135076,1.50000000000442),(-1.49999999999116,2.59807621135842),(1.53102359078377e-11,3),(1.50000000001768,2.59807621134311),(2.59807621136607,1.4999999999779),(3,-3.06204718156754e-11),(2.59807621133545,-1.50000000003094),(1.49999999996464,-2.59807621137373),(-4.59307077235131e-11,-3),(-1.5000000000442,-2.5980762113278),(-2.59807621138138,-1.49999999995138))
       | ((-99,2),(-85.6025403783588,52.0000000001473),(-48.9999999997054,88.602540378614),(1.00000000051034,102),(51.0000000005893,88.6025403781036),(87.6025403788692,51.9999999992634),(101,1.99999999897932),(87.6025403778485,-48.0000000010313),(50.9999999988214,-84.6025403791243),(0.999999998468976,-98),(-49.0000000014732,-84.6025403775933),(-85.6025403793795,-47.9999999983795))
       | ((-4,3),(-3.33012701891794,5.50000000000737),(-1.49999999998527,7.3301270189307),(1.00000000002552,8),(3.50000000002946,7.33012701890518),(5.33012701894346,5.49999999996317),(6,2.99999999994897),(5.33012701889242,0.499999999948437),(3.49999999994107,-1.33012701895622),(0.999999999923449,-2),(-1.50000000007366,-1.33012701887966),(-3.33012701896897,0.500000000081028))
       | ((-2,2),(-1.59807621135076,3.50000000000442),(-0.499999999991161,4.59807621135842),(1.00000000001531,5),(2.50000000001768,4.59807621134311),(3.59807621136607,3.4999999999779),(4,1.99999999996938),(3.59807621133545,0.499999999969062),(2.49999999996464,-0.59807621137373),(0.999999999954069,-1),(-0.500000000044197,-0.598076211327799),(-1.59807621138138,0.500000000048617))
       | ((90,200),(91.3397459621641,205.000000000015),(95.0000000000295,208.660254037861),(100.000000000051,210),(105.000000000059,208.66025403781),(108.660254037887,204.999999999926),(110,199.999999999898),(108.660254037785,194.999999999897),(104.999999999882,191.339745962088),(99.9999999998469,190),(94.9999999998527,191.339745962241),(91.3397459620621,195.000000000162))
!      | ((0,0),(13.3974596216412,50.0000000001473),(50.0000000002946,86.602540378614),(100.00000000051,100),(150.000000000589,86.6025403781036),(186.602540378869,49.9999999992634),(200,-1.02068239385585e-09),(186.602540377848,-50.0000000010313),(149.999999998821,-86.6025403791243),(99.999999998469,-100),(49.9999999985268,-86.6025403775933),(13.3974596206205,-49.9999999983795))
  (6 rows)
  
  -- convert the circle to an 8-point polygon
--- 443,454 ----
     FROM CIRCLE_TBL;
   six |                                                                                                                                                                                           polygon                                                                                                                                                                                           
  -----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!      | ((-3,0),(-2.59807621135076,1.50000000000442),(-1.49999999999116,2.59807621135842),(1.53102359027555e-11,3),(1.50000000001768,2.59807621134311),(2.59807621136607,1.4999999999779),(3,-3.06204718131343e-11),(2.59807621133545,-1.50000000003094),(1.49999999996464,-2.59807621137373),(-4.59307077057254e-11,-3),(-1.5000000000442,-2.5980762113278),(-2.59807621138138,-1.49999999995138))
       | ((-99,2),(-85.6025403783588,52.0000000001473),(-48.9999999997054,88.602540378614),(1.00000000051034,102),(51.0000000005893,88.6025403781036),(87.6025403788692,51.9999999992634),(101,1.99999999897932),(87.6025403778485,-48.0000000010313),(50.9999999988214,-84.6025403791243),(0.999999998468976,-98),(-49.0000000014732,-84.6025403775933),(-85.6025403793795,-47.9999999983795))
       | ((-4,3),(-3.33012701891794,5.50000000000737),(-1.49999999998527,7.3301270189307),(1.00000000002552,8),(3.50000000002946,7.33012701890518),(5.33012701894346,5.49999999996317),(6,2.99999999994897),(5.33012701889242,0.499999999948437),(3.49999999994107,-1.33012701895622),(0.999999999923449,-2),(-1.50000000007366,-1.33012701887966),(-3.33012701896897,0.500000000081028))
       | ((-2,2),(-1.59807621135076,3.50000000000442),(-0.499999999991161,4.59807621135842),(1.00000000001531,5),(2.50000000001768,4.59807621134311),(3.59807621136607,3.4999999999779),(4,1.99999999996938),(3.59807621133545,0.499999999969062),(2.49999999996464,-0.59807621137373),(0.999999999954069,-1),(-0.500000000044197,-0.598076211327799),(-1.59807621138138,0.500000000048617))
       | ((90,200),(91.3397459621641,205.000000000015),(95.0000000000295,208.660254037861),(100.000000000051,210),(105.000000000059,208.66025403781),(108.660254037887,204.999999999926),(110,199.999999999898),(108.660254037785,194.999999999897),(104.999999999882,191.339745962088),(99.9999999998469,190),(94.9999999998527,191.339745962241),(91.3397459620621,195.000000000162))
!      | ((0,0),(13.3974596216412,50.0000000001473),(50.0000000002946,86.602540378614),(100.00000000051,100),(150.000000000589,86.6025403781036),(186.602540378869,49.9999999992634),(200,-1.02068239377114e-09),(186.602540377848,-50.0000000010313),(149.999999998821,-86.6025403791243),(99.999999998469,-100),(49.9999999985268,-86.6025403775933),(13.3974596206205,-49.9999999983795))
  (6 rows)
  
  -- convert the circle to an 8-point polygon
***************
*** 456,467 ****
     FROM CIRCLE_TBL;
   six |                                                                                                                  polygon                                                                                                                  
  -----+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!      | ((-3,0),(-2.12132034355423,2.12132034356506),(1.53102359078377e-11,3),(2.12132034357588,2.1213203435434),(3,-3.06204718156754e-11),(2.12132034353258,-2.12132034358671),(-4.59307077235131e-11,-3),(-2.12132034359753,-2.12132034352175))
       | ((-99,2),(-69.7106781184743,72.7106781188352),(1.00000000051034,102),(71.710678119196,72.7106781181134),(101,1.99999999897932),(71.7106781177526,-68.7106781195569),(0.999999998468976,-98),(-69.7106781199178,-68.7106781173917))
       | ((-4,3),(-2.53553390592372,6.53553390594176),(1.00000000002552,8),(4.5355339059598,6.53553390590567),(6,2.99999999994897),(4.53553390588763,-0.535533905977846),(0.999999999923449,-2),(-2.53553390599589,-0.535533905869586))
       | ((-2,2),(-1.12132034355423,4.12132034356506),(1.00000000001531,5),(3.12132034357588,4.1213203435434),(4,1.99999999996938),(3.12132034353258,-0.121320343586707),(0.999999999954069,-1),(-1.12132034359753,-0.121320343521752))
       | ((90,200),(92.9289321881526,207.071067811884),(100.000000000051,210),(107.07106781192,207.071067811811),(110,199.999999999898),(107.071067811775,192.928932188044),(99.9999999998469,190),(92.9289321880082,192.928932188261))
!      | ((0,0),(29.2893218815257,70.7106781188352),(100.00000000051,100),(170.710678119196,70.7106781181134),(200,-1.02068239385585e-09),(170.710678117753,-70.7106781195569),(99.999999998469,-100),(29.2893218800822,-70.7106781173917))
  (6 rows)
  
  --
--- 456,467 ----
     FROM CIRCLE_TBL;
   six |                                                                                                                  polygon                                                                                                                  
  -----+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
!      | ((-3,0),(-2.12132034355423,2.12132034356506),(1.53102359027555e-11,3),(2.12132034357588,2.1213203435434),(3,-3.06204718131343e-11),(2.12132034353258,-2.12132034358671),(-4.59307077057254e-11,-3),(-2.12132034359753,-2.12132034352175))
       | ((-99,2),(-69.7106781184743,72.7106781188352),(1.00000000051034,102),(71.710678119196,72.7106781181134),(101,1.99999999897932),(71.7106781177526,-68.7106781195569),(0.999999998468976,-98),(-69.7106781199178,-68.7106781173917))
       | ((-4,3),(-2.53553390592372,6.53553390594176),(1.00000000002552,8),(4.5355339059598,6.53553390590567),(6,2.99999999994897),(4.53553390588763,-0.535533905977846),(0.999999999923449,-2),(-2.53553390599589,-0.535533905869586))
       | ((-2,2),(-1.12132034355423,4.12132034356506),(1.00000000001531,5),(3.12132034357588,4.1213203435434),(4,1.99999999996938),(3.12132034353258,-0.121320343586707),(0.999999999954069,-1),(-1.12132034359753,-0.121320343521752))
       | ((90,200),(92.9289321881526,207.071067811884),(100.000000000051,210),(107.07106781192,207.071067811811),(110,199.999999999898),(107.071067811775,192.928932188044),(99.9999999998469,190),(92.9289321880082,192.928932188261))
!      | ((0,0),(29.2893218815257,70.7106781188352),(100.00000000051,100),(170.710678119196,70.7106781181134),(200,-1.02068239377114e-09),(170.710678117753,-70.7106781195569),(99.999999998469,-100),(29.2893218800822,-70.7106781173917))
  (6 rows)
  
  --

======================================================================

#3Rod Taylor
rbt@rbt.ca
In reply to: Noname (#1)
1 attachment(s)
psql tab completion

Clean up psql:

Add simple ALTER DATABASE, ALTER TRIGGER, CHECK POINT, CREATE
CONVERSION, CREATE DOMAIN, CREATE LANGUAGE, DEALLOCATE, DROP CONVERSION,
DROP DOMAIN, DROP LANGUAGE, EXECUTE, PREPARE

Complete CAST in CREATE CAST and DROP CAST but doesn't suggest what
should follow.

Add many more SET / SHOW variables to the list. Taken from SHOW ALL
output.

Complete a case sensitive search to allow \dD, \dd, \dS, \ds, \h, \H to
complete properly. But there are no matches, then try a case
insensitive search to allow case conversion. Add all missing help
options.

\Q<tab> -> \q
\dD<tab> -> \dD
\dd<tab> -> \dd
\D<tab><tab><tab> -> \d (with listing of \d? commands)
sel<tab> -> SELECT

On the other hand, in psql , tab-completion doesn't seem to
work for certain commands :

ALTER DATABASE ; ALTER TRIGGER ; CHECKPOINT ; CREATE CAST ;
CREATE CONSTRAINT TRIGGER ; CREATE CONVERSION ; CREATE DOMAIN ;
CREATE LANGUAGE ; DEALLOCATE ; DROP CAST ; DROP CONVERSION ;
DROP DOMAIN ; DROP LANGUAGE ; EXECUTE ; PREPARE

( this could be considered a low priority todo item , though )

--
Rod Taylor

Attachments:

psql.patchtext/plain; charset=ISO-8859-1; name=psql.patchDownload
? src/bin/psql/.tab-complete.c.swp
? src/bin/psql/psql
Index: src/bin/psql//tab-complete.c
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/tab-complete.c,v
retrieving revision 1.64
diff -c -r1.64 tab-complete.c
*** src/bin/psql//tab-complete.c	2002/09/04 20:31:36	1.64
--- src/bin/psql//tab-complete.c	2002/11/12 04:21:28
***************
*** 141,149 ****
--- 141,153 ----
  
  pgsql_thing_t words_after_create[] = {
  	{"AGGREGATE", "SELECT DISTINCT proname FROM pg_catalog.pg_proc WHERE proisagg AND substr(proname,1,%d)='%s'"},
+ 	{"CAST", NULL},				/* Casts have complex structures for namees, so skip it */
+ 	{"CONVERSION", "SELECT conname FROM pg_catalog.pg_conversion WHERE substr(conname,1,%d)='%s'"},
  	{"DATABASE", Query_for_list_of_databases},
+ 	{"DOMAIN", "SELECT typname FROM pg_catalog.pg_type WHERE typtype = 'd' AND substr(typname,1,%d)='%s'"},
  	{"FUNCTION", "SELECT DISTINCT proname FROM pg_catalog.pg_proc WHERE substr(proname,1,%d)='%s'"},
  	{"GROUP", "SELECT groname FROM pg_catalog.pg_group WHERE substr(groname,1,%d)='%s'"},
+ 	{"LANGUAGE", "SELECT lanname FROM pg_catalog.pg_language WHERE substr(lanname,1,%d)='%s'"},
  	{"INDEX", Query_for_list_of_indexes},
  	{"OPERATOR", NULL},			/* Querying for this is probably not such
  								 * a good idea. */
***************
*** 196,206 ****
  			   *prev4_wd;
  
  	static char *sql_commands[] = {
! 		"ABORT", "ALTER", "ANALYZE", "BEGIN", "CLOSE", "CLUSTER", "COMMENT", "COMMIT", "COPY",
! 		"CREATE", "DECLARE", "DELETE", "DROP", "EXPLAIN", "FETCH", "GRANT",
! 		"INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY", "REINDEX", "RESET",
! 		"REVOKE", "ROLLBACK", "SELECT", "SET", "SHOW", "TRUNCATE", "UNLISTEN", "UPDATE",
! 		"VACUUM", NULL
  	};
  
  	static char *pgsql_variables[] = {
--- 200,210 ----
  			   *prev4_wd;
  
  	static char *sql_commands[] = {
! 		"ABORT", "ALTER", "ANALYZE", "BEGIN", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT",
! 		"COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE", "DELETE", "DROP", "EXECUTE",
! 		"EXPLAIN", "FETCH", "GRANT", "INSERT", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY",
! 		"PREPARE", "REINDEX", "RESET", "REVOKE", "ROLLBACK", "SELECT", "SET", "SHOW",
! 		"TRUNCATE", "UNLISTEN", "UPDATE", "VACUUM", NULL
  	};
  
  	static char *pgsql_variables[] = {
***************
*** 220,288 ****
  		 * the rest should match USERSET entries in
  		 * backend/utils/misc/guc.c
  		 */
! 		"enable_seqscan",
! 		"enable_indexscan",
! 		"enable_tidscan",
! 		"enable_sort",
! 		"enable_nestloop",
! 		"enable_mergejoin",
! 		"enable_hashjoin",
! 		"geqo",
! 		"fsync",
! 		"server_min_messages",
  		"client_min_messages",
! 		"debug_assertions",
! 		"log_statement",
! 		"log_duration",
  		"debug_print_parse",
- 		"debug_print_rewritten",
  		"debug_print_plan",
! 		"debug_pretty_print",
! 		"show_parser_stats",
! 		"show_planner_stats",
! 		"show_executor_stats",
! 		"show_statement_stats",
! 		"trace_notify",
! 		"explain_pretty_print",
! 		"sql_inheritance",
! 		"australian_timezones",
! 		"password_encryption",
! 		"transform_null_equals",
! 		"autocommit",
! 
  		"default_statistics_target",
! 		"geqo_threshold",
! 		"geqo_pool_size",
  		"geqo_effort",
  		"geqo_generations",
  		"geqo_random_seed",
! 		"sort_mem",
! 		"vacuum_mem",
  		"max_expr_depth",
! 		"commit_delay",
! 		"commit_siblings",
! 
! 		"effective_cache_size",
  		"random_page_cost",
- 		"cpu_tuple_cost",
- 		"cpu_index_tuple_cost",
- 		"cpu_operator_cost",
- 		"geqo_selection_bias",
- 
- 		"default_transaction_isolation",
  		"search_path",
  		"statement_timeout",
! 		"log_min_error_statement",
  		NULL
  	};
  
  	static char *backslash_commands[] = {
! 		"\\connect", "\\copy", "\\d", "\\da", "\\dd", "\\df", "\\di",
! 		"\\dl", "\\do", "\\dp", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv",
! 		"\\e", "\\echo",
! 		"\\encoding", "\\g", "\\h", "\\i", "\\l",
  		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
! 		"\\o", "\\p", "\\pset", "\\q", "\\qecho", "\\r", "\\set", "\\t",
  		"\\timing", "\\unset", "\\x", "\\w", "\\z", "\\!", NULL
  	};
  
--- 224,333 ----
  		 * the rest should match USERSET entries in
  		 * backend/utils/misc/guc.c
  		 */
! 		"australian_timezones",
! 		"authentication_timeout",
! 		"autocommit",
! 		"checkpoint_segments",
! 		"checkpoint_timeout",
  		"client_min_messages",
! 		"commit_delay",
! 		"commit_siblings",
! 		"cpu_index_tuple_cost",
! 		"cpu_operator_cost",
! 		"cpu_tuple_cost",
! 		"db_user_namespace",
! 		"deadlock_timeout",
! 		"debug_pretty_print",
  		"debug_print_parse",
  		"debug_print_plan",
! 		"debug_print_rewritten",
  		"default_statistics_target",
! 		"default_transaction_isolation",
! 		"dynamic_library_path",
! 		"effective_cache_size",
! 		"enable_hashjoin",
! 		"enable_indexscan",
! 		"enable_mergejoin",
! 		"enable_nestloop",
! 		"enable_seqscan",
! 		"enable_sort",
! 		"enable_tidscan",
! 		"explain_pretty_print",
! 		"fixbtree",
! 		"fsync",
! 		"geqo",
  		"geqo_effort",
  		"geqo_generations",
+ 		"geqo_pool_size",
  		"geqo_random_seed",
! 		"geqo_selection_bias",
! 		"geqo_threshold",
! 		"hostname_lookup",
! 		"krb_server_keyfile",
! 		"lc_messages",
! 		"lc_monetary",
! 		"lc_numeric",
! 		"lc_timeC",
! 		"log_connections",
! 		"log_duration",
! 		"log_min_error_statement",
! 		"log_pid",
! 		"log_statement",
! 		"log_timestamp",
! 		"max_connections",
  		"max_expr_depth",
! 		"max_files_per_process",
! 		"max_fsm_pages",
! 		"max_fsm_relations",
! 		"max_locks_per_transaction",
! 		"password_encryption",
! 		"port",
! 		"pre_auth_delay",
  		"random_page_cost",
  		"search_path",
+ 		"server_min_messages",
+ 		"shared_buffers",
+ 		"show_executor_stats",
+ 		"show_parser_stats",
+ 		"show_planner_stats",
+ 		"show_source_port",
+ 		"show_statement_stats",
+ 		"silent_mode",
+ 		"sort_mem",
+ 		"sql_inheritance",
+ 		"ssl",
  		"statement_timeout",
! 		"stats_block_level",
! 		"stats_command_string",
! 		"stats_reset_on_server_start",
! 		"stats_row_level",
! 		"stats_start_collector",
! 		"superuser_reserved_connections",
! 		"syslog",
! 		"syslog_facility",
! 		"syslog_ident",
! 		"tcpip_socket",
! 		"trace_notify",
! 		"transform_null_equals",
! 		"unix_socket_directory",
! 		"unix_socket_group",
! 		"unix_socket_permissions",
! 		"vacuum_mem",
! 		"virtual_hostt",
! 		"wal_buffers",
! 		"wal_debug",
! 		"wal_sync_method",
  		NULL
  	};
  
  	static char *backslash_commands[] = {
! 		"\\a", "\\connect", "\\C", "\\cd", "\\copy", "\\copyright", 
! 		"\\d", "\\da", "\\dd", "\\dD", "\\df", "\\di", "\\dl", "\\do",
! 		"\\dp", "\\ds", "\\dS", "\\dt", "\\dT", "\\dv","\\du",
! 		"\\e", "\\echo", "\\encoding",
! 		"\\f", "\\g", "\\h", "\\help", "\\H", "\\i", "\\l",
  		"\\lo_import", "\\lo_export", "\\lo_list", "\\lo_unlink",
! 		"\\o", "\\p", "\\pset", "\\q", "\\qecho", "\\r", "\\set", "\\t", "\\T",
  		"\\timing", "\\unset", "\\x", "\\w", "\\z", "\\!", NULL
  	};
  
***************
*** 322,335 ****
  		matches = completion_matches(text, create_command_generator);
  
  /* ALTER */
! 	/* complete with what you can alter (TABLE, GROUP, USER) */
  	else if (strcasecmp(prev_wd, "ALTER") == 0)
  	{
! 		char	   *list_ALTER[] = {"GROUP", "SCHEMA", "TABLE", "USER", NULL};
  
  		COMPLETE_WITH_LIST(list_ALTER);
  	}
  
  	/*
  	 * If we detect ALTER TABLE <name>, suggest either ADD, ALTER, or
  	 * RENAME
--- 367,398 ----
  		matches = completion_matches(text, create_command_generator);
  
  /* ALTER */
! 	/* complete with what you can alter (TABLE, GROUP, USER, ...) */
  	else if (strcasecmp(prev_wd, "ALTER") == 0)
  	{
! 		char	   *list_ALTER[] = {"DATABASE", "GROUP", "SCHEMA", "TABLE", "TRIGGER", "USER", NULL};
  
  		COMPLETE_WITH_LIST(list_ALTER);
  	}
  
+ 	/* ALTER DATABASE <name> */
+ 	else if (strcasecmp(prev3_wd, "ALTER") == 0 && strcasecmp(prev2_wd, "DATABASE") == 0)
+ 	{
+ 		char	   *list_ALTERDATABASE[] = {"RESET", "SET", NULL};
+ 
+ 		COMPLETE_WITH_LIST(list_ALTERDATABASE);
+ 	}
+ 	/* ALTER TRIGGER <name>, add ON */
+ 	else if (strcasecmp(prev3_wd, "ALTER") == 0 && strcasecmp(prev2_wd, "TRIGGER") == 0)
+ 		COMPLETE_WITH_CONST("ON");
+ 
+ 	/*
+ 	 * If we have ALTER TRIGGER <sth> ON, then add the correct tablename
+ 	 */
+ 	else if (strcasecmp(prev4_wd, "ALTER") == 0 && strcasecmp(prev3_wd, "TRIGGER") == 0
+ 	  && strcasecmp(prev_wd, "ON") == 0)
+ 		COMPLETE_WITH_QUERY(Query_for_list_of_tables);
+ 
  	/*
  	 * If we detect ALTER TABLE <name>, suggest either ADD, ALTER, or
  	 * RENAME
***************
*** 969,975 ****
  complete_from_list(char *text, int state)
  {
  	static int	string_length,
! 				list_index;
  	char	   *item;
  
  	/* need to have a list */
--- 1032,1040 ----
  complete_from_list(char *text, int state)
  {
  	static int	string_length,
! 				list_index,
! 				matches;
! 	static bool	casesensitive;
  	char	   *item;
  
  	/* need to have a list */
***************
*** 982,992 ****
  	{
  		list_index = 0;
  		string_length = strlen(text);
  	}
  
  	while ((item = completion_charpp[list_index++]))
! 		if (strncasecmp(text, item, string_length) == 0)
  			return xstrdup(item);
  
  	/* If no more matches, return null. */
  	return NULL;
--- 1047,1081 ----
  	{
  		list_index = 0;
  		string_length = strlen(text);
+ 		casesensitive = true;
+ 		matches = 0;
  	}
  
  	while ((item = completion_charpp[list_index++]))
! 	{
! 		/* First pass is case sensitive */
! 		if (casesensitive && strncmp(text, item, string_length) == 0)
! 		{
! 			matches++;
! 			return xstrdup(item);
! 		}
! 
! 		/* Second pass is case insensitive, don't bother counting matches */
! 		if (!casesensitive && strncasecmp(text, item, string_length) == 0)
  			return xstrdup(item);
+ 	}
+ 
+ 	/*
+ 	 * No matches found. If we're not case insensitive already, lets switch
+ 	 * to being case insensitive and try again
+ 	 */
+ 	if (casesensitive && matches == 0)
+ 	{
+ 		casesensitive = false;
+ 		list_index = 0;
+ 		state++;
+ 		return (complete_from_list(text, state));
+ 	}
  
  	/* If no more matches, return null. */
  	return NULL;
#4Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Rod Taylor (#3)
Re: psql tab completion

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

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

Rod Taylor wrote:

Clean up psql:

Add simple ALTER DATABASE, ALTER TRIGGER, CHECK POINT, CREATE
CONVERSION, CREATE DOMAIN, CREATE LANGUAGE, DEALLOCATE, DROP CONVERSION,
DROP DOMAIN, DROP LANGUAGE, EXECUTE, PREPARE

Complete CAST in CREATE CAST and DROP CAST but doesn't suggest what
should follow.

Add many more SET / SHOW variables to the list. Taken from SHOW ALL
output.

Complete a case sensitive search to allow \dD, \dd, \dS, \ds, \h, \H to
complete properly. But there are no matches, then try a case
insensitive search to allow case conversion. Add all missing help
options.

\Q<tab> -> \q
\dD<tab> -> \dD
\dd<tab> -> \dd
\D<tab><tab><tab> -> \d (with listing of \d? commands)
sel<tab> -> SELECT

On the other hand, in psql , tab-completion doesn't seem to
work for certain commands :

ALTER DATABASE ; ALTER TRIGGER ; CHECKPOINT ; CREATE CAST ;
CREATE CONSTRAINT TRIGGER ; CREATE CONVERSION ; CREATE DOMAIN ;
CREATE LANGUAGE ; DEALLOCATE ; DROP CAST ; DROP CONVERSION ;
DROP DOMAIN ; DROP LANGUAGE ; EXECUTE ; PREPARE

( this could be considered a low priority todo item , though )

--
Rod Taylor

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  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, Pennsylvania 19073
#5Bruce Momjian
pgman@candle.pha.pa.us
In reply to: Rod Taylor (#3)
Re: psql tab completion

Nice comprehensive patch applied. Thanks.

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

Rod Taylor wrote:

Clean up psql:

Add simple ALTER DATABASE, ALTER TRIGGER, CHECK POINT, CREATE
CONVERSION, CREATE DOMAIN, CREATE LANGUAGE, DEALLOCATE, DROP CONVERSION,
DROP DOMAIN, DROP LANGUAGE, EXECUTE, PREPARE

Complete CAST in CREATE CAST and DROP CAST but doesn't suggest what
should follow.

Add many more SET / SHOW variables to the list. Taken from SHOW ALL
output.

Complete a case sensitive search to allow \dD, \dd, \dS, \ds, \h, \H to
complete properly. But there are no matches, then try a case
insensitive search to allow case conversion. Add all missing help
options.

\Q<tab> -> \q
\dD<tab> -> \dD
\dd<tab> -> \dd
\D<tab><tab><tab> -> \d (with listing of \d? commands)
sel<tab> -> SELECT

On the other hand, in psql , tab-completion doesn't seem to
work for certain commands :

ALTER DATABASE ; ALTER TRIGGER ; CHECKPOINT ; CREATE CAST ;
CREATE CONSTRAINT TRIGGER ; CREATE CONVERSION ; CREATE DOMAIN ;
CREATE LANGUAGE ; DEALLOCATE ; DROP CAST ; DROP CONVERSION ;
DROP DOMAIN ; DROP LANGUAGE ; EXECUTE ; PREPARE

( this could be considered a low priority todo item , though )

--
Rod Taylor

[ Attachment, skipping... ]

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

-- 
  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, Pennsylvania 19073