Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 25a64f7

Browse files
committed
Fix for \z formatting from Tom Lane.
1 parent 4b048fb commit 25a64f7

File tree

5 files changed

+72
-17
lines changed

5 files changed

+72
-17
lines changed

src/backend/optimizer/util/ordering.c

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.7 1998/09/01 03:23:54 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/Attic/ordering.c,v 1.8 1998/09/21 02:25:21 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -38,29 +38,24 @@ equal_path_path_ordering(PathOrder *path_ordering1,
3838
if (path_ordering1->ordtype == MERGE_ORDER &&
3939
path_ordering2->ordtype == MERGE_ORDER)
4040
{
41-
4241
return equal(path_ordering1->ord.merge, path_ordering2->ord.merge);
43-
4442
}
4543
else if (path_ordering1->ordtype == SORTOP_ORDER &&
4644
path_ordering2->ordtype == SORTOP_ORDER)
4745
{
48-
4946
return
5047
(equal_sortops_order(path_ordering1->ord.sortop,
5148
path_ordering2->ord.sortop));
5249
}
5350
else if (path_ordering1->ordtype == MERGE_ORDER &&
5451
path_ordering2->ordtype == SORTOP_ORDER)
5552
{
56-
5753
return (path_ordering2->ord.sortop &&
5854
(path_ordering1->ord.merge->left_operator ==
5955
path_ordering2->ord.sortop[0]));
6056
}
6157
else
6258
{
63-
6459
return (path_ordering1->ord.sortop &&
6560
(path_ordering1->ord.sortop[0] ==
6661
path_ordering2->ord.merge->left_operator));

src/bin/psql/psql.c

+49-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.160 1998/09/03 05:08:25 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.161 1998/09/21 02:25:23 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -156,6 +156,7 @@ static int tableList(PsqlSettings *pset, bool deep_tablelist,
156156
static int tableDesc(PsqlSettings *pset, char *table, FILE *fout);
157157
static int objectDescription(PsqlSettings *pset, char *object);
158158
static int rightsList(PsqlSettings *pset);
159+
static void emitNtimes (FILE *fout, const char *str, int N);
159160
static void prompt_for_password(char *username, char *password);
160161

161162
static char *gets_noreadline(char *prompt, FILE *source);
@@ -244,7 +245,7 @@ slashUsage(PsqlSettings *pset)
244245

245246
/* if you add/remove a line here, change the row test above */
246247
fprintf(fout, " \\? -- help\n");
247-
fprintf(fout, " \\a -- toggle field-alignment (currenty %s)\n", on(pset->opt.align));
248+
fprintf(fout, " \\a -- toggle field-alignment (currently %s)\n", on(pset->opt.align));
248249
fprintf(fout, " \\C [<captn>] -- set html3 caption (currently '%s')\n", pset->opt.caption ? pset->opt.caption : "");
249250
fprintf(fout, " \\connect <dbname|-> <user> -- connect to new database (currently '%s')\n", PQdb(pset->db));
250251
fprintf(fout, " \\copy table {from | to} <fname>\n");
@@ -540,6 +541,8 @@ rightsList(PsqlSettings *pset)
540541
char listbuf[512];
541542
int nColumns;
542543
int i;
544+
int maxCol1Len;
545+
int maxCol2Len;
543546
int usePipe = 0;
544547
char *pagerenv;
545548
FILE *fout;
@@ -583,21 +586,50 @@ rightsList(PsqlSettings *pset)
583586
else
584587
fout = stdout;
585588

589+
/* choose column widths */
590+
maxCol1Len = strlen("Relation");
591+
maxCol2Len = strlen("Grant/Revoke Permissions");
592+
for (i = 0; i < PQntuples(res); i++)
593+
{
594+
int l = strlen(PQgetvalue(res, i, 0));
595+
if (l > maxCol1Len)
596+
maxCol1Len = l;
597+
l = strlen(PQgetvalue(res, i, 1));
598+
if (l > maxCol2Len)
599+
maxCol2Len = l;
600+
}
601+
586602
/* Display the information */
587603

588604
fprintf(fout, "\nDatabase = %s\n", PQdb(pset->db));
589-
fprintf(fout, " +------------------+----------------------------------------------------+\n");
590-
fprintf(fout, " | Relation | Grant/Revoke Permissions |\n");
591-
fprintf(fout, " +------------------+----------------------------------------------------+\n");
605+
fprintf(fout, " +");
606+
emitNtimes(fout, "-", maxCol1Len+2);
607+
fprintf(fout, "+");
608+
emitNtimes(fout, "-", maxCol2Len+2);
609+
fprintf(fout, "+\n");
610+
fprintf(fout, " | %-*s | %-*s |\n",
611+
maxCol1Len, "Relation",
612+
maxCol2Len, "Grant/Revoke Permissions");
613+
fprintf(fout, " +");
614+
emitNtimes(fout, "-", maxCol1Len+2);
615+
fprintf(fout, "+");
616+
emitNtimes(fout, "-", maxCol2Len+2);
617+
fprintf(fout, "+\n");
592618

593619
/* next, print out the instances */
594620
for (i = 0; i < PQntuples(res); i++)
595621
{
596-
fprintf(fout, " | %-16.16s", PQgetvalue(res, i, 0));
597-
fprintf(fout, " | %-50.50s | ", PQgetvalue(res, i, 1));
598-
fprintf(fout, "\n");
622+
fprintf(fout, " | %-*s | %-*s |\n",
623+
maxCol1Len, PQgetvalue(res, i, 0),
624+
maxCol2Len, PQgetvalue(res, i, 1));
599625
}
600-
fprintf(fout, " +------------------+----------------------------------------------------+\n");
626+
627+
fprintf(fout, " +");
628+
emitNtimes(fout, "-", maxCol1Len+2);
629+
fprintf(fout, "+");
630+
emitNtimes(fout, "-", maxCol2Len+2);
631+
fprintf(fout, "+\n");
632+
601633
PQclear(res);
602634
if (usePipe)
603635
{
@@ -614,6 +646,14 @@ rightsList(PsqlSettings *pset)
614646
}
615647
}
616648

649+
static void emitNtimes (FILE *fout, const char *str, int N)
650+
{
651+
int i;
652+
for (i = 0; i < N; i++) {
653+
fputs(str, fout);
654+
}
655+
}
656+
617657
/*
618658
* Describe a table
619659
*

src/include/port/svr4.h

+7
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@
88
#define BYTE_ORDER BIG_ENDIAN
99
#endif
1010
#endif
11+
12+
#ifdef sinix
13+
#define HAS_TEST_AND_SET
14+
15+
#include <abi_mutex.h>
16+
typedef abilock_t slock_t;
17+
#endif

src/include/storage/s_lock.h

+14-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.49 1998/09/18 17:18:41 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/include/storage/s_lock.h,v 1.50 1998/09/21 02:25:27 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -273,6 +273,19 @@ static const slock_t clear_lock =
273273
#define S_LOCK_FREE(lock) (test_then_add(lock,0) == 0)
274274
#endif /* __sgi */
275275

276+
#if defined(sinix)
277+
/*
278+
* SINIX / Reliant UNIX
279+
* slock_t is defined as a struct abilock_t, which has a single unsigned long
280+
* member. (Basically same as SGI)
281+
*
282+
*/
283+
#define TAS(lock) (!acquire_lock(lock))
284+
#define S_UNLOCK(lock) release_lock(lock)
285+
#define S_INIT_LOCK(lock) init_lock(lock)
286+
#define S_LOCK_FREE(lock) (stat_lock(lock) == UNLOCKED)
287+
#endif /* sinix */
288+
276289

277290
#if defined(_AIX)
278291
/*

src/interfaces/ecpg/preproc/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ uninstall:
2525

2626
# Rule that really do something.
2727
ecpg: $(OBJ)
28-
$(CC) -o ecpg $(OBJ) $(LEXLIB)
28+
$(CC) -o ecpg $(OBJ) $(LEXLIB) $(LDFLAGS)
2929

3030
y.tab.h y.tab.c: preproc.y
3131
$(YACC) $(YFLAGS) $<

0 commit comments

Comments
 (0)