View | Details | Raw Unified | Return to bug 84522
Collapse All | Expand All

(-)gtksql/files/patch-postgres.c (-2 / +46 lines)
Lines 1-5 Link Here
1
--- postgres.c.orig	Sat Apr 21 19:16:37 2001
1
--- postgres.c.orig	Sat Jun  5 15:05:36 1999
2
+++ postgres.c	Sat Apr 21 19:16:47 2001
2
+++ postgres.c	Wed Aug  3 17:22:55 2005
3
@@ -18,7 +18,7 @@
3
@@ -18,7 +18,7 @@
4
 
4
 
5
 #include <libpq-fe.h>
5
 #include <libpq-fe.h>
Lines 9-11 Link Here
9
 
9
 
10
 #include "common.h"
10
 #include "common.h"
11
 #include "status.h"
11
 #include "status.h"
12
@@ -129,14 +129,7 @@
13
   PGresult *table_info;
14
   char query[512];
15
 
16
-  sprintf(query, "SELECT a.attnum, a.attname, t.typname, a.attlen,
17
-                         a.atttypmod, a.attnotnull, a.atthasdef
18
-                  FROM pg_class c, pg_attribute a, pg_type t
19
-                  WHERE c.relname = '%s' AND
20
-                        a.attnum > 0 AND
21
-                        a.attrelid = c.oid AND
22
-                        a.atttypid = t.oid
23
-                  ORDER BY attnum", tbf->name);
24
+  sprintf(query, "SELECT a.attnum, a.attname, t.typname, a.attlen, a.atttypmod, a.attnotnull, a.atthasdef FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '%s' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid ORDER BY attnum", tbf->name);
25
   
26
   table_info = PQexec(conn, query);
27
   if ((table_info == NULL) ||
28
@@ -183,11 +176,7 @@
29
       if (rnotnull[0] == 't')
30
 	strcat(type_str, " not null");
31
       if (rhasdef[0] == 't') {
32
-	sprintf(buf, "SELECT d.adsrc
33
-                      FROM pg_attrdef d, pg_class c
34
-                      WHERE c.relname = '%s' AND
35
-                            c.oid = d.adrelid AND
36
-                            d.adnum = %s",
37
+	sprintf(buf, "SELECT d.adsrc FROM pg_attrdef d, pg_class c WHERE c.relname = '%s' AND c.oid = d.adrelid AND d.adnum = %s",
38
 		tbf->name, PQgetvalue(table_info, i, 0));
39
 	table_info2 = PQexec(conn, buf);
40
 	if ((table_info2 == NULL) ||
41
@@ -240,13 +229,7 @@
42
     PGresult *tables;
43
     char query[512];
44
     
45
-    sprintf(query, "SELECT usename, relname, relkind, relhasrules
46
-                    FROM pg_class, pg_user
47
-                    WHERE relkind = 'r' AND
48
-                          relname !~ '^pg_' AND
49
-                          relname !~ '^xin[vx][0-9]+' AND
50
-                          usesysid = relowner
51
-                    ORDER BY relname");
52
+    sprintf(query, "SELECT usename, relname, relkind, relhasrules FROM pg_class, pg_user WHERE relkind = 'r' AND relname !~ '^pg_' AND relname !~ '^xin[vx][0-9]+' AND usesysid = relowner ORDER BY relname");
53
   
54
     tables = PQexec(conn->conn, query);
55
     if ((tables == NULL) || (PQresultStatus(tables) != PGRES_TUPLES_OK)) {

Return to bug 84522