summaryrefslogtreecommitdiff
path: root/databases/gtksql/patches/patch-ab
blob: 7882cfcf61b3db0b0e381a9d60f7e8e5d126797b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
$NetBSD: patch-ab,v 1.1 2003/09/08 12:13:50 kleink Exp $

--- postgres.c.orig	1999-06-05 15:05:36.000000000 +0200
+++ postgres.c	2003-09-08 14:11:15.000000000 +0200
@@ -129,14 +129,14 @@
   PGresult *table_info;
   char query[512];
 
-  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);
+  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);
   
   table_info = PQexec(conn, query);
   if ((table_info == NULL) ||
@@ -183,11 +183,11 @@
       if (rnotnull[0] == 't')
 	strcat(type_str, " not null");
       if (rhasdef[0] == 't') {
-	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",
+	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",
 		tbf->name, PQgetvalue(table_info, i, 0));
 	table_info2 = PQexec(conn, buf);
 	if ((table_info2 == NULL) ||
@@ -240,13 +240,13 @@
     PGresult *tables;
     char query[512];
     
-    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");
+    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");
   
     tables = PQexec(conn->conn, query);
     if ((tables == NULL) || (PQresultStatus(tables) != PGRES_TUPLES_OK)) {