Skip to content

Commit 96dcb04

Browse files
authored
Merge pull request #939 from OreoYang/IVORY_REL_5_STABLE
add display ivorysql version in psql welcome banner and select().
2 parents 2b0bbcd + 233e86b commit 96dcb04

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,23 @@ Untested combinations of 'autoconf' and PostgreSQL versions are not
2424
recommended. You can remove the check from 'configure.ac' but it is then
2525
your responsibility whether the result works or not.])])
2626
AC_COPYRIGHT([Copyright (c) 1996-2025, PostgreSQL Global Development Group])
27+
AC_COPYRIGHT([Portions Copyright (c), 2023-2025, IvorySQL Global Development Team])
2728
AC_CONFIG_SRCDIR([src/backend/access/common/heaptuple.c])
2829
AC_CONFIG_AUX_DIR(config)
2930
AC_PREFIX_DEFAULT(/usr/local/pgsql)
3031
AC_DEFINE_UNQUOTED(CONFIGURE_ARGS, ["$ac_configure_args"], [Saved arguments from configure])
3132

33+
# IvorySQL version
34+
PACKAGE_IVORYSQL_VERSION='5.0'
35+
3236
[PG_MAJORVERSION=`expr "$PACKAGE_VERSION" : '\([0-9][0-9]*\)'`]
3337
[PG_MINORVERSION=`expr "$PACKAGE_VERSION" : '.*\.\([0-9][0-9]*\)'`]
3438
test -n "$PG_MINORVERSION" || PG_MINORVERSION=0
3539
AC_SUBST(PG_MAJORVERSION)
3640
AC_DEFINE_UNQUOTED(PG_MAJORVERSION, "$PG_MAJORVERSION", [PostgreSQL major version as a string])
3741
AC_DEFINE_UNQUOTED(PG_MAJORVERSION_NUM, $PG_MAJORVERSION, [PostgreSQL major version number])
3842
AC_DEFINE_UNQUOTED(PG_MINORVERSION_NUM, $PG_MINORVERSION, [PostgreSQL minor version number])
43+
AC_DEFINE_UNQUOTED([PACKAGE_IVORYSQL_VERSION], "$PACKAGE_IVORYSQL_VERSION" , [IvorySQL version number])
3944

4045
PGAC_ARG_REQ(with, extra-version, [STRING], [append STRING to version],
4146
[PG_VERSION="$PACKAGE_VERSION$withval"],
@@ -2553,7 +2558,7 @@ else
25532558
fi
25542559

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

25592564
# 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: 10 additions & 7 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);
@@ -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)