Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25a64f7

Browse files
committed
Fix for \z formatting from Tom Lane.
1 parent4b048fb commit25a64f7

File tree

5 files changed

+72
-17
lines changed

5 files changed

+72
-17
lines changed

‎src/backend/optimizer/util/ordering.c

Lines changed: 1 addition & 6 deletions
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
returnequal(path_ordering1->ord.merge,path_ordering2->ord.merge);
43-
4442
}
4543
elseif (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
elseif (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

Lines changed: 49 additions & 9 deletions
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
staticinttableDesc(PsqlSettings*pset,char*table,FILE*fout);
157157
staticintobjectDescription(PsqlSettings*pset,char*object);
158158
staticintrightsList(PsqlSettings*pset);
159+
staticvoidemitNtimes (FILE*fout,constchar*str,intN);
159160
staticvoidprompt_for_password(char*username,char*password);
160161

161162
staticchar*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
charlistbuf[512];
541542
intnColumns;
542543
inti;
544+
intmaxCol1Len;
545+
intmaxCol2Len;
543546
intusePipe=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+
intl=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+
staticvoidemitNtimes (FILE*fout,constchar*str,intN)
650+
{
651+
inti;
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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,10 @@
88
#defineBYTE_ORDERBIG_ENDIAN
99
#endif
1010
#endif
11+
12+
#ifdefsinix
13+
#defineHAS_TEST_AND_SET
14+
15+
#include<abi_mutex.h>
16+
typedefabilock_tslock_t;
17+
#endif

‎src/include/storage/s_lock.h

Lines changed: 14 additions & 1 deletion
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
#defineS_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+
#defineTAS(lock)(!acquire_lock(lock))
284+
#defineS_UNLOCK(lock)release_lock(lock)
285+
#defineS_INIT_LOCK(lock)init_lock(lock)
286+
#defineS_LOCK_FREE(lock)(stat_lock(lock) == UNLOCKED)
287+
#endif/* sinix */
288+
276289

277290
#if defined(_AIX)
278291
/*

‎src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 1 deletion
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.hy.tab.c: preproc.y
3131
$(YACC)$(YFLAGS)$<

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp