CartoDB / cartodb-postgresql

PostgreSQL extension for CartoDB
BSD 3-Clause "New" or "Revised" License
111 stars 53 forks source link

Refactor: remove overloaded CDB_SetUp_PG_Federated_Table methods #376

Closed rafatower closed 5 years ago

rafatower commented 5 years ago

In order to do so, the main method has to have a couple of default values for input params, and perform a number of null checks.

The advantage is that it reduces the code by 1/2 and that fixes are to be performed in just one place, insteda of spreading it 2 functions.

rafatower commented 5 years ago

For the record, tests working in my local env:

``` $ make clean all install installcheck ... > Executing query 'REVOKE CONNECT ON DATABASE "test_organizations" FROM cdb_org_admin;' > Code Result: 0; Result: REVOKE; Error output: ; Code result after warnings: 0 > Executing query 'DROP ROLE cdb_testmember_1;' > Code Result: 0; Result: DROP ROLE; Error output: ; Code result after warnings: 0 > Executing query 'DROP ROLE cdb_testmember_2;' > Code Result: 0; Result: DROP ROLE; Error output: ; Code result after warnings: 0 > Executing query 'DROP ROLE cdb_org_admin;' > Code Result: 0; Result: DROP ROLE; Error output: ; Code result after warnings: 0 DROP DATABASE /home/rtorre/usr/local/pg11/lib/postgresql/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/home/rtorre/usr/local/pg11/bin' --dbname=contrib_regression test_setup test/CDB_OverviewsTest test/CDB_HeadsTailsBinsTest test/CDB_QueryStatementsTest test/CDB_RectangleTest test/CDB_QuotaTest test/CDB_GhostTables test/CDB_StatsTest test/CDB_DateToNumberTest test/CDB_GreatCircle test/CDB_MathTest test/CDB_AnalysisCheckTest test/CDB_JenksBinsTest test/CDB_QueryTablesTest test/CDB_SyncTableTest test/CDB_HexagonTest test/CDB_QuantileBinsTest test/CDB_DistinctMeasureTest test/CDB_CartodbfyTableTest test/CDB_EqualIntervalBinsTest test/CDB_Username test/CDB_XYZ_ExtentTest test/CDB_DistTypeTest test/CDB_HelperTest test/CDB_UserTablesTest test/CDB_DigitSeparatorTest test/CDB_EstimateRowCountTest test/CDB_TransformToWebmercatorTest test/CDB_OAuth (using postmaster on Unix socket, default port) ============== dropping database "contrib_regression" ============== DROP DATABASE ============== creating database "contrib_regression" ============== CREATE DATABASE ALTER DATABASE ============== running regression test queries ============== test test_setup ... ok test test/CDB_OverviewsTest ... ok test test/CDB_HeadsTailsBinsTest ... ok test test/CDB_QueryStatementsTest ... ok test test/CDB_RectangleTest ... ok test test/CDB_QuotaTest ... ok test test/CDB_GhostTables ... ok test test/CDB_StatsTest ... ok test test/CDB_DateToNumberTest ... ok test test/CDB_GreatCircle ... ok test test/CDB_MathTest ... ok test test/CDB_AnalysisCheckTest ... ok test test/CDB_JenksBinsTest ... ok test test/CDB_QueryTablesTest ... ok test test/CDB_SyncTableTest ... ok test test/CDB_HexagonTest ... ok test test/CDB_QuantileBinsTest ... ok test test/CDB_DistinctMeasureTest ... ok test test/CDB_CartodbfyTableTest ... ok test test/CDB_EqualIntervalBinsTest ... ok test test/CDB_Username ... ok test test/CDB_XYZ_ExtentTest ... ok test test/CDB_DistTypeTest ... ok test test/CDB_HelperTest ... ok test test/CDB_UserTablesTest ... ok test test/CDB_DigitSeparatorTest ... ok test test/CDB_EstimateRowCountTest ... ok test test/CDB_TransformToWebmercatorTest ... ok test test/CDB_OAuth ... ok ====================== All 29 tests passed. ====================== ```

CI broken because of package dependencies. I'm merging in my integration branch anyway.