-
Notifications
You must be signed in to change notification settings - Fork 617
Postgres Modifications
- [Starting Postgres under GDB] (https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD#Starting_Postgres_under_GDB)
- [Tips and tricks from an open-source developer] (http://michael.otacoo.com/manuals/postgresql/)
- [Compilation of useful links] (https://github.com/ty4z2008/Qix/blob/master/pg.md)
The following files should be automatically generated:
- /src/postgres/backend/bootstrap/bootparse.c
- /src/postgres/backend/bootstrap/bootscanner.c
- /src/postgres/backend/parser/scan.c
- /src/postgres/backend/parser/gram.c
- /src/postgres/backend/replication/repl_gram.c
- /src/postgres/backend/replication/repl_scanner.c
- /src/postgres/backend/utils/fmgrtab.c
- /src/postgres/backend/utils/misc/guc-file.c
- /src/postgres/backend/utils/sort/qsort_tuple.c
- /tools/pg_psql/sql_help.c
- /tools/pg_psql/psql_scan.c
In order to port Postgres to C++, we made the following changes:
- Avoid keyword conflict
All variables that have conflicts with C++ keyword are appended with "___". Details of the cases are as follows:
new
namespace
friend
public
private
typename
typeid
constexpr
operator
class
-
Make use of C++ inheritance to avoid casting
All derived nodes struct in
parsenodes.h
are redefined using C++ inheritance. -
Resolve error for missing operator=
Define
operator=
manually for the cases where volatile qualifier is used. C++ does not generate assignment operator for such cases by default. Deails of the cases are as follows:-
RelFileNode
atinclude/storage/relfilnode.h
-
QueuePosition
atbackend/commands/async.cpp
-
BufferTag
atinclude/storage/buf_internals.h
-
-
Resolve error for implicitly deleted default constructor
union
's default constructor is implictly deleted if one of its member has non-trivial constructor. The work around is to define the constructor mannually. Details of the cases are as follows:-
SharedInvalidationMessage
arinclude/storage/sinval.h
-
-
Resolve error for missing
operator++
The work around is to use
operator+
, instead ofoperator++
. We changed all the occurrances offorkNum++
toforkNum = forkNum + 1
-
Resolve error for missing namespace for inner enum
Member enums have to be resolved by specifying class name. Details of the cases are as follows:
JsonbValue
-
Avoid redefinition for static array
Forward declaration for static array would be recognized as redefinition in C++. The work around is to add an anonymous namespace for them. The details of the the cases are as follows:
-
pg_crc32c_table
atport/pg_crc32c_sb8.cpp
-
-
Resolve unreference problem for extern const variable
The work around is to add
extern
at the place where the variable is defined Details of the cases are as follows:-
sync_method_options
atbackend/access/transam/xlog.cpp
-
wal_level_options
atbackend/access/rmgrdesc/xlogdesc.cpp
-
dynamic_shared_memory_options
atbackend/access/transam/xlog.cpp
-
archive_mode_options
atbackend/access/transam/xlog.cpp
-
-
Resolve the differece of function pointer in C and C++
In C, it is possible to declare a function that takes arbitray number of argument. But it is not the case in C++. The work around is to explicitly define funciton pointer types for different number of arguments. The datails of the cases are as follows:
-
func_ptr0
atbackend/utils/fmgr/fmgr.c
-
func_ptr1
atbackend/utils/fmgr/fmgr.c
-
func_ptr2
atbackend/utils/fmgr/fmgr.c
-
func_ptr3
atbackend/utils/fmgr/fmgr.c
-
func_ptr4
atbackend/utils/fmgr/fmgr.c
-
func_ptr5
atbackend/utils/fmgr/fmgr.c
-
func_ptr6
atbackend/utils/fmgr/fmgr.c
-
func_ptr7
atbackend/utils/fmgr/fmgr.c
-
func_ptr8
atbackend/utils/fmgr/fmgr.c
-
func_ptr9
atbackend/utils/fmgr/fmgr.c
-
func_ptr10
atbackend/utils/fmgr/fmgr.c
-
func_ptr11
atbackend/utils/fmgr/fmgr.c
-
func_ptr12
atbackend/utils/fmgr/fmgr.c
-
func_ptr13
atbackend/utils/fmgr/fmgr.c
-
func_ptr14
atbackend/utils/fmgr/fmgr.c
-
func_ptr15
atbackend/utils/fmgr/fmgr.c
-
func_ptr16
atbackend/utils/fmgr/fmgr.c
-
expression_tree_walker
atinclude/nodes/nodeFunc.h
-
expression_tree_mutator
atinclude/nodes/nodeFunc.h
-
query_tree_walker
atinclude/nodes/nodeFunc.h
-
query_tree_mutator
atinclude/nodes/nodeFunc.h
-
range_table_walker
atinclude/nodes/nodeFunc.h
-
range_table_mutator
atinclude/nodes/nodeFunc.h
-
query_or_expression_tree_walker
atinclude/nodes/nodeFunc.h
-
query_or_expression_tree_mutator
atinclude/nodes/nodeFunc.h
-
raw_expression_tree_walker
atinclude/nodes/nodeFunc.h
-
-
Changed C-style typecasts to static_cast in multiple files at:
/src/postgres/interfaces/libpq
/src/postgres/backend/access/brin
/src/postgres/backend/access/gin
/src/postgres/backend/access/gist
-
Changed multiple C-style casts to reinterpret_cast, especially in:
/src/postgres/backend/access/fe-lobj.cpp
-
Suppressed warnings for String to char * conversion (which has been deprecated) by adding the CXXFLAG Wno-write-string
-
Added a macro at the end of c.h file to suppress compiler warning for unused variables in various function calls. Used this UNUSED macro wherever variables passed to a function were either unused or used in #ifdef ... #endif