[gnome-db] PostgreSQL provider segfault and patch



I get a segfault when I call gda_connection_get_schema () for
GDA_CONNECTION_GET_SCHEMA_FIELDS:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1083972288 (LWP 16853)]
0x40ad3b2a in get_postgres_fields_metadata (cnc=0x0,
params=0x40ad9149) at gda-postgres-provider.c:2075
2075                    if (arr == NULL || arr[0][0] == '\0') {

This happens when a index have a function instead of  column name:

create unique index alumnos_idx on alumnos (lower (nombre));

I attach a simple patch to avoid this.
-- 
Juan Manuel Mouriz
Buenos Aires
Argentina
Index: gda-postgres-provider.c
===================================================================
RCS file: /cvs/gnome/libgda/providers/postgres/gda-postgres-provider.c,v
retrieving revision 1.90
diff -u -3 -r1.90 gda-postgres-provider.c
--- gda-postgres-provider.c	6 Aug 2005 12:52:18 -0000	1.90
+++ gda-postgres-provider.c	12 Aug 2005 17:26:53 -0000
@@ -2055,7 +2055,7 @@
 					 "WHERE c.relname = '%s' "
 					 "AND c.oid = i.indrelid "
 					 "AND i.indexrelid = c2.oid "
-					 "AND pg_catalog.pg_table_is_visible(c.oid)", tblname);
+					 "AND pg_catalog.pg_table_is_visible(c.oid) AND i.indkey [0] <> 0", tblname);
 
 	pg_idx = PQexec(priv_data->pconn, query);
 	g_free (query);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]