Fix for \z formatting from Tom Lane.
authorBruce Momjian
Mon, 21 Sep 1998 02:25:29 +0000 (02:25 +0000)
committerBruce Momjian
Mon, 21 Sep 1998 02:25:29 +0000 (02:25 +0000)
src/backend/optimizer/util/ordering.c
src/bin/psql/psql.c
src/include/port/svr4.h
src/include/storage/s_lock.h
src/interfaces/ecpg/preproc/Makefile

index 1157a3c70985e4bae707b53649c4b26e05107d5a..f440f23080f26d9736845edf845f780857548d52 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.7 1998/09/01 03:23:54 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.8 1998/09/21 02:25:21 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -38,14 +38,11 @@ equal_path_path_ordering(PathOrder *path_ordering1,
    if (path_ordering1->ordtype == MERGE_ORDER &&
        path_ordering2->ordtype == MERGE_ORDER)
    {
-
        return equal(path_ordering1->ord.merge, path_ordering2->ord.merge);
-
    }
    else if (path_ordering1->ordtype == SORTOP_ORDER &&
             path_ordering2->ordtype == SORTOP_ORDER)
    {
-
        return
            (equal_sortops_order(path_ordering1->ord.sortop,
                                 path_ordering2->ord.sortop));
@@ -53,14 +50,12 @@ equal_path_path_ordering(PathOrder *path_ordering1,
    else if (path_ordering1->ordtype == MERGE_ORDER &&
             path_ordering2->ordtype == SORTOP_ORDER)
    {
-
        return (path_ordering2->ord.sortop &&
                (path_ordering1->ord.merge->left_operator ==
                 path_ordering2->ord.sortop[0]));
    }
    else
    {
-
        return (path_ordering1->ord.sortop &&
                (path_ordering1->ord.sortop[0] ==
                 path_ordering2->ord.merge->left_operator));
index 80a917cb1db488c806842874754136bb30964fa4..dfc91ee79437710fef716e68a18a6d42933b5c15 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.160 1998/09/03 05:08:25 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.161 1998/09/21 02:25:23 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -156,6 +156,7 @@ static int tableList(PsqlSettings *pset, bool deep_tablelist,
 static int tableDesc(PsqlSettings *pset, char *table, FILE *fout);
 static int objectDescription(PsqlSettings *pset, char *object);
 static int rightsList(PsqlSettings *pset);
+static void emitNtimes (FILE *fout, const char *str, int N);
 static void prompt_for_password(char *username, char *password);
 
 static char *gets_noreadline(char *prompt, FILE *source);
@@ -244,7 +245,7 @@ slashUsage(PsqlSettings *pset)
 
    /* if you add/remove a line here, change the row test above */
    fprintf(fout, " \\?           -- help\n");
-   fprintf(fout, " \\a           -- toggle field-alignment (currenty %s)\n", on(pset->opt.align));
+   fprintf(fout, " \\a           -- toggle field-alignment (currently %s)\n", on(pset->opt.align));
    fprintf(fout, " \\C [] -- set html3 caption (currently '%s')\n", pset->opt.caption ? pset->opt.caption : "");
    fprintf(fout, " \\connect   -- connect to new database (currently '%s')\n", PQdb(pset->db));
    fprintf(fout, " \\copy table {from | to} \n");
@@ -540,6 +541,8 @@ rightsList(PsqlSettings *pset)
    char        listbuf[512];
    int         nColumns;
    int         i;
+   int         maxCol1Len;
+   int         maxCol2Len;
    int         usePipe = 0;
    char       *pagerenv;
    FILE       *fout;
@@ -583,21 +586,50 @@ rightsList(PsqlSettings *pset)
        else
            fout = stdout;
 
+       /* choose column widths */
+       maxCol1Len = strlen("Relation");
+        maxCol2Len = strlen("Grant/Revoke Permissions");
+       for (i = 0; i < PQntuples(res); i++)
+       {
+           int l = strlen(PQgetvalue(res, i, 0));
+           if (l > maxCol1Len)
+               maxCol1Len = l;
+           l = strlen(PQgetvalue(res, i, 1));
+           if (l > maxCol2Len)
+               maxCol2Len = l;
+       }
+
        /* Display the information */
 
        fprintf(fout, "\nDatabase    = %s\n", PQdb(pset->db));
-       fprintf(fout, " +------------------+----------------------------------------------------+\n");
-       fprintf(fout, " |  Relation        |             Grant/Revoke Permissions               |\n");
-       fprintf(fout, " +------------------+----------------------------------------------------+\n");
+       fprintf(fout, " +");
+       emitNtimes(fout, "-", maxCol1Len+2);
+       fprintf(fout, "+");
+       emitNtimes(fout, "-", maxCol2Len+2);
+       fprintf(fout, "+\n");
+       fprintf(fout, " | %-*s | %-*s |\n",
+               maxCol1Len, "Relation",
+               maxCol2Len, "Grant/Revoke Permissions");
+       fprintf(fout, " +");
+       emitNtimes(fout, "-", maxCol1Len+2);
+       fprintf(fout, "+");
+       emitNtimes(fout, "-", maxCol2Len+2);
+       fprintf(fout, "+\n");
 
        /* next, print out the instances */
        for (i = 0; i < PQntuples(res); i++)
        {
-           fprintf(fout, " | %-16.16s", PQgetvalue(res, i, 0));
-           fprintf(fout, " | %-50.50s | ", PQgetvalue(res, i, 1));
-           fprintf(fout, "\n");
+           fprintf(fout, " | %-*s | %-*s |\n",
+                   maxCol1Len, PQgetvalue(res, i, 0),
+                   maxCol2Len, PQgetvalue(res, i, 1));
        }
-       fprintf(fout, " +------------------+----------------------------------------------------+\n");
+
+       fprintf(fout, " +");
+       emitNtimes(fout, "-", maxCol1Len+2);
+       fprintf(fout, "+");
+       emitNtimes(fout, "-", maxCol2Len+2);
+       fprintf(fout, "+\n");
+
        PQclear(res);
        if (usePipe)
        {
@@ -614,6 +646,14 @@ rightsList(PsqlSettings *pset)
    }
 }
 
+static void emitNtimes (FILE *fout, const char *str, int N)
+{
+   int i;
+   for (i = 0; i < N; i++) {
+       fputs(str, fout);
+   }
+}
+
 /*
  * Describe a table
  *
index 56e7dbd9e2df5217f509e5726950d136b1edde19..b5d2a80e56b60847f4a755dd125bcaf590ec98a0 100644 (file)
@@ -8,3 +8,10 @@
 #define            BYTE_ORDER      BIG_ENDIAN
 #endif
 #endif
+
+#ifdef sinix
+#define HAS_TEST_AND_SET
+
+#include 
+typedef abilock_t slock_t;
+#endif
index 7b531fda72571314abab7e640d8cbca68706dff4..d3f9d6d9b2fa925ec6cadf562c07881e4a2654f6 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.49 1998/09/18 17:18:41 momjian Exp $
+ *   $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.50 1998/09/21 02:25:27 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -273,6 +273,19 @@ static const slock_t clear_lock =
 #define S_LOCK_FREE(lock)  (test_then_add(lock,0) == 0)
 #endif  /* __sgi */
 
+#if defined(sinix)
+/*
+ * SINIX / Reliant UNIX 
+ * slock_t is defined as a struct abilock_t, which has a single unsigned long
+ * member. (Basically same as SGI)
+ *
+ */
+#define TAS(lock)  (!acquire_lock(lock))
+#define S_UNLOCK(lock) release_lock(lock)
+#define S_INIT_LOCK(lock)  init_lock(lock)
+#define S_LOCK_FREE(lock)  (stat_lock(lock) == UNLOCKED)
+#endif  /* sinix */
 
 #if defined(_AIX)
 /*
index 207259559586243f6b0c45084e9686fedb95a82e..9ddd1fdd18fd6bf1af29782b6191c216f77f51fb 100644 (file)
@@ -25,7 +25,7 @@ uninstall:
 
 # Rule that really do something.
 ecpg: $(OBJ)
-   $(CC) -o ecpg $(OBJ) $(LEXLIB)
+   $(CC) -o ecpg $(OBJ) $(LEXLIB) $(LDFLAGS)
 
 y.tab.h y.tab.c: preproc.y
    $(YACC) $(YFLAGS) $<