Skip to content

Commit

Permalink
fix updating from 1.x to 2.y when y > 0 (#12)
Browse files Browse the repository at this point in the history
Functions in the SQL script for each diskquota 2.x version refer to the exact
name of shared library, e.g. for diskquota-2.1.so. As a result, upgrade from
2.0 to 2.2 is impossible without presence of 2.1 shared library as far as each
extension function validated by loading shared library and checking symbol
name. This patch implement symlinks creation logic to coup this problem.
Symlinks for each previous release to the latest shared library will be
created. But we need to control changing of sql function during next syncs.
  • Loading branch information
RekGRpth authored Mar 28, 2023
1 parent 0b53c8a commit 472eb06
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,11 @@ install(PROGRAMS "cmake/install_gpdb_component" DESTINATION ".")
install(FILES ${diskquota_DDL} DESTINATION "share/postgresql/extension/")
install(TARGETS diskquota DESTINATION "lib/postgresql/")
install(FILES ${build_info_PATH} DESTINATION ".")

file(GLOB sql_files RELATIVE ${CMAKE_SOURCE_DIR} diskquota--2.*.sql)
list(FILTER sql_files EXCLUDE REGEX ".*--.*--.*")
list(FILTER sql_files EXCLUDE REGEX ".*diskquota--${DISKQUOTA_MAJOR_VERSION}.${DISKQUOTA_MINOR_VERSION}.*")
foreach(so IN LISTS sql_files)
string(REGEX REPLACE "^diskquota--([0-9]+)\.([0-9]+).sql$" "diskquota-\\1.\\2.so" so ${so})
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ${DISKQUOTA_BINARY_NAME}.so \"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/postgresql/${so}\")")
endforeach()

0 comments on commit 472eb06

Please sign in to comment.