Skip to content

Commit 2507621

Browse files
committed
add display ivorysql version in psql welcome banner and select(). fix issue#557
1 parent 2b0bbcd commit 2507621

5 files changed

Lines changed: 24 additions & 12 deletions

File tree

‎configure‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19644,9 +19644,15 @@ else
1964419644
cc_string=$CC
1964519645
fi
1964619646

19647+
# IvorySQL version
19648+
PACKAGE_IVORYSQL_VERSION='5.0'
1964719649

1964819650
cat >>confdefs.h <<_ACEOF
19649-
#define PG_VERSION_STR "PostgreSQL $PG_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
19651+
#define PACKAGE_IVORYSQL_VERSION "$PACKAGE_IVORYSQL_VERSION"
19652+
_ACEOF
19653+
19654+
cat >>confdefs.h <<_ACEOF
19655+
#define PG_VERSION_STR "PostgreSQL $PG_VERSION (IvorySQL $PACKAGE_IVORYSQL_VERSION) on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
1965019656
_ACEOF
1965119657

1965219658

‎configure.ac‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2553,7 +2553,7 @@ else
25532553
fi
25542554

25552555
AC_DEFINE_UNQUOTED(PG_VERSION_STR,
2556-
["PostgreSQL $PG_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
2556+
["PostgreSQL $PG_VERSION (IvorySQL $PACKAGE_IVORYSQL_VERSION) on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"],
25572557
[A string containing the version number, platform, and C compiler])
25582558

25592559
# Supply a numeric version string for use by 3rd party add-ons

‎meson.build‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ cdata.set('PG_MAJORVERSION_NUM', pg_version_major)
155155
cdata.set('PG_MINORVERSION_NUM', pg_version_minor)
156156
cdata.set('PG_VERSION_NUM', pg_version_num)
157157

158-
cdata.set('PACKAGE_IVORYSQL_VERSION', ivorysql_version)
158+
cdata.set_quoted('PACKAGE_IVORYSQL_VERSION', ivorysql_version)
159159
# PG_VERSION_STR is built later, it depends on compiler test results
160160
cdata.set_quoted('CONFIGURE_ARGS', '')
161161

@@ -2982,7 +2982,7 @@ cdata.set_quoted('DLSUFFIX', dlsuffix)
29822982
cdata.set_quoted('PG_VERSION_STR',
29832983
'PostgreSQL (IvorySQL @6@) @0@ on @1@-@2@, compiled by @3@-@4@, @5@-bit'.format(
29842984
pg_version, host_machine.cpu_family(), host_system,
2985-
cc.get_id(), cc.version(), cdata.get('SIZEOF_VOID_P') * 8, cdata.get('PACKAGE_IVORYSQL_VERSION')
2985+
cc.get_id(), cc.version(), cdata.get('SIZEOF_VOID_P') * 8, ivorysql_version
29862986
)
29872987
)
29882988

‎src/bin/psql/command.c‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
#include "mainloop.h"
4343
#include "pqexpbuffer.h"
4444
#include "psqlscanslash.h"
45-
#include "ora_psqlscanslash.h"
45+
#include "ora_psqlscanslash.h"
4646
#include "settings.h"
4747
#include "variables.h"
4848

@@ -311,7 +311,7 @@ HandleSlashCmds(PsqlScanState scan_state,
311311
/* if there is a trailing \\, swallow it */
312312
if (db_mode == DB_PG)
313313
psql_scan_slash_command_end(scan_state);
314-
else if(db_mode == DB_ORACLE)
314+
else if (db_mode == DB_ORACLE)
315315
ora_psql_scan_slash_command_end(scan_state);
316316

317317
free(cmd);
@@ -1059,6 +1059,7 @@ exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd)
10591059
show_system = strchr(cmd, 'S') ? true : false;
10601060

10611061
getDbCompatibleMode(pset.db);
1062+
10621063
/*
10631064
* The 'x' option turns expanded mode on for this command only. This
10641065
* is allowed in all \d* commands, except \d by itself, since \dx is a
@@ -3628,6 +3629,7 @@ static backslashResult
36283629
exec_command_parser(PsqlScanState scan_state, bool active_branch)
36293630
{
36303631
bool success = true;
3632+
36313633
if (active_branch)
36323634
{
36333635
getDbCompatibleMode(pset.db);
@@ -4520,7 +4522,7 @@ connection_warnings(bool in_startup)
45204522
}
45214523
/* For version match, only print psql banner on startup. */
45224524
else if (in_startup)
4523-
printf("%s (%s)\n", pset.progname, PG_VERSION);
4525+
printf("%s(%s), %s(%s)\n", pset.progname, PG_VERSION, "ivorysql", PACKAGE_IVORYSQL_VERSION);
45244526

45254527
/*
45264528
* Warn if server's major version is newer than ours, or if server
@@ -5286,7 +5288,7 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
52865288
/* header line width in expanded mode */
52875289
else if (strcmp(param, "xheader_width") == 0)
52885290
{
5289-
if (! value)
5291+
if (!value)
52905292
;
52915293
else if (pg_strcasecmp(value, "full") == 0)
52925294
popt->topt.expanded_header_width_type = PRINT_XHEADER_FULL;
@@ -5838,15 +5840,16 @@ pset_value_string(const char *param, printQueryOpt *popt)
58385840
else if (strcmp(param, "xheader_width") == 0)
58395841
{
58405842
if (popt->topt.expanded_header_width_type == PRINT_XHEADER_FULL)
5841-
return(pstrdup("full"));
5843+
return (pstrdup("full"));
58425844
else if (popt->topt.expanded_header_width_type == PRINT_XHEADER_COLUMN)
5843-
return(pstrdup("column"));
5845+
return (pstrdup("column"));
58445846
else if (popt->topt.expanded_header_width_type == PRINT_XHEADER_PAGE)
5845-
return(pstrdup("page"));
5847+
return (pstrdup("page"));
58465848
else
58475849
{
58485850
/* must be PRINT_XHEADER_EXACT_WIDTH */
5849-
char wbuff[32];
5851+
char wbuff[32];
5852+
58505853
snprintf(wbuff, sizeof(wbuff), "%d",
58515854
popt->topt.expanded_header_exact_width);
58525855
return pstrdup(wbuff);

‎src/include/pg_config.h.in‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,9 @@
630630
/* PostgreSQL version as a number */
631631
#undef PG_VERSION_NUM
632632

633+
/*IvorySQL version as a string*/
634+
#undef PACKAGE_IVORYSQL_VERSION
635+
633636
/* A string containing the version number, platform, and C compiler */
634637
#undef PG_VERSION_STR
635638

0 commit comments

Comments
 (0)