Skip to content

Commit 2266dab

Browse files
authored
Merge pull request IvorySQL#940 from OreoYang/master
Master branch: add display ivorysql version in psql welcome banner and select().
2 parents cc486ca + 87beae2 commit 2266dab

File tree

5 files changed

+29
-12
lines changed

5 files changed

+29
-12
lines changed

configure

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19618,9 +19618,15 @@ else
1961819618
cc_string=$CC
1961919619
fi
1962019620

19621+
# IvorySQL version
19622+
PACKAGE_IVORYSQL_VERSION='5beta1'
1962119623

1962219624
cat >>confdefs.h <<_ACEOF
19623-
#define PG_VERSION_STR "PostgreSQL $PG_VERSION on $host, compiled by $cc_string, `expr $ac_cv_sizeof_void_p \* 8`-bit"
19625+
#define PACKAGE_IVORYSQL_VERSION "$PACKAGE_IVORYSQL_VERSION"
19626+
_ACEOF
19627+
19628+
cat >>confdefs.h <<_ACEOF
19629+
#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"
1962419630
_ACEOF
1962519631

1962619632

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='5beta1'
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"],
@@ -2543,7 +2548,7 @@ else
25432548
fi
25442549

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

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

meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ project('postgresql',
2828
)
2929

3030
# IvorySQL version
31-
ivorysql_version = '5.0'
31+
ivorysql_version = '5beta1'
3232

3333

3434
###############################################################
@@ -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

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

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

@@ -294,7 +294,7 @@ HandleSlashCmds(PsqlScanState scan_state,
294294
/* if there is a trailing \\, swallow it */
295295
if (db_mode == DB_PG)
296296
psql_scan_slash_command_end(scan_state);
297-
else if(db_mode == DB_ORACLE)
297+
else if (db_mode == DB_ORACLE)
298298
ora_psql_scan_slash_command_end(scan_state);
299299

300300
free(cmd);
@@ -1038,6 +1038,7 @@ exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd)
10381038
show_system = strchr(cmd, 'S') ? true : false;
10391039

10401040
getDbCompatibleMode(pset.db);
1041+
10411042
/*
10421043
* The 'x' option turns expanded mode on for this command only. This
10431044
* is allowed in all \d* commands, except \d by itself, since \dx is a
@@ -3538,6 +3539,7 @@ static backslashResult
35383539
exec_command_parser(PsqlScanState scan_state, bool active_branch)
35393540
{
35403541
bool success = true;
3542+
35413543
if (active_branch)
35423544
{
35433545
getDbCompatibleMode(pset.db);
@@ -5191,7 +5193,7 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
51915193
/* header line width in expanded mode */
51925194
else if (strcmp(param, "xheader_width") == 0)
51935195
{
5194-
if (! value)
5196+
if (!value)
51955197
;
51965198
else if (pg_strcasecmp(value, "full") == 0)
51975199
popt->topt.expanded_header_width_type = PRINT_XHEADER_FULL;
@@ -5743,15 +5745,16 @@ pset_value_string(const char *param, printQueryOpt *popt)
57435745
else if (strcmp(param, "xheader_width") == 0)
57445746
{
57455747
if (popt->topt.expanded_header_width_type == PRINT_XHEADER_FULL)
5746-
return(pstrdup("full"));
5748+
return (pstrdup("full"));
57475749
else if (popt->topt.expanded_header_width_type == PRINT_XHEADER_COLUMN)
5748-
return(pstrdup("column"));
5750+
return (pstrdup("column"));
57495751
else if (popt->topt.expanded_header_width_type == PRINT_XHEADER_PAGE)
5750-
return(pstrdup("page"));
5752+
return (pstrdup("page"));
57515753
else
57525754
{
57535755
/* must be PRINT_XHEADER_EXACT_WIDTH */
5754-
char wbuff[32];
5756+
char wbuff[32];
5757+
57555758
snprintf(wbuff, sizeof(wbuff), "%d",
57565759
popt->topt.expanded_header_exact_width);
57575760
return pstrdup(wbuff);

src/include/pg_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,9 @@
627627
/* PostgreSQL version as a number */
628628
#undef PG_VERSION_NUM
629629

630+
/*IvorySQL version as a string*/
631+
#undef PACKAGE_IVORYSQL_VERSION
632+
630633
/* A string containing the version number, platform, and C compiler */
631634
#undef PG_VERSION_STR
632635

0 commit comments

Comments
 (0)