Commit Graph

107 Commits

Author SHA1 Message Date
Raul Ochoa
2637742c2e CDB-3743 Makes CDB_QueryTables to return only results for schemas associated to Relation-Names 2014-08-01 18:06:06 +02:00
Kartones
679af1d4a3 CDB-3497 Finished stabilizing specs 2014-07-28 17:53:19 +02:00
Kartones
6d665ab163 CDB-3497 ongoing spec stabilization 2014-07-28 15:16:19 +02:00
Kartones
e5c8015e17 CDB-3497 Splitted 2014-07-28 13:11:51 +02:00
Kartones
f61d07518d CDB-3497 ongoing splitting 2014-07-28 12:25:42 +02:00
Kartones
b5589fdf09 CDB-3497 2014-07-25 12:19:40 +02:00
Kartones
9500010a67 CDB-3497 Partial splitting 2014-07-25 10:52:46 +02:00
Raul Ochoa
2bd0b223a6 CDB_SetUserQuotaInBytes returning set value instead of previous value. 2014-07-07 10:36:51 +02:00
Raul Ochoa
5806ac8f8d Force schema so it can calculate the size of the database with the proper schema 2014-07-04 18:50:46 +02:00
Kartones
1c86599f9d CDB-3094 Discovered that EXECUTE FORMAT seems to quote schema names when it needs to 2014-07-04 16:39:19 +02:00
Kartones
3c5251e6c6 CDB-3303 Cartodbfication also supporting optional schemas 2014-07-04 15:55:08 +02:00
Kartones
3d595976f6 CDB-3302 CDB_CheckQuota now also accepts a schema name. Added a convenience method to check if a schema is valid or not 2014-07-04 11:48:53 +02:00
Kartones
021d922d84 CDB-3304 Method cdb_userdatasize now has schema_name param, and added backwards-compatible version without it 2014-07-04 10:57:55 +02:00
Luis Bosque
82f2e7336b Quoted schema references in organization sql 2014-07-03 15:33:36 +02:00
Raul Ochoa
558be8b693 CDB-3094 DELETE permission for read-write rule 2014-06-27 00:01:25 +01:00
Raul Ochoa
b98419aeb8 Merge remote-tracking branch 'rambo/cdb_querytables_support_schemas' into CDB-3094 2014-06-26 08:12:41 +02:00
javi
da9b9a640f CDB_QueryTables return tables with schema 2014-06-25 19:38:29 +02:00
Raul Ochoa
55efde5039 CDB-3094 Makes organization member group role name unique to database by using the database name md5 hash 2014-06-25 12:38:14 +02:00
Raul Ochoa
12e90ef6a4 CDB-3094 Adds cdb_org_member role group and functions to handle access to tables through it 2014-06-24 19:56:17 +02:00
Raul Ochoa
625b01ed56 CDB-3094 Removes for now the role groups management as it is not clear if we need them 2014-06-19 20:16:10 +02:00
Raul Ochoa
5e5471c474 CDB-3094 changes signature to allow specifying the schema because it does not have to be the role name.
- fixes tests to match new signature.
- does not revoke access to the schema when revoking access to a table. TODO
2014-06-19 20:16:10 +02:00
Raul Ochoa
8dec91de87 Merge branch 'master' of https://github.com/CartoDB/cartodb-postgresql into CDB-3094 2014-06-16 18:56:34 +02:00
Raul Ochoa
9a55b03d6f CDB-3094 initial function to share tables/schemas between users within the same database 2014-06-16 16:10:53 +02:00
Sandro Santilli
bc0966c46e Do not add unique index on cartodb_id if already a primary key
Closes #38
2014-06-11 19:21:19 +02:00
Sandro Santilli
81bbfcbda8 Drop useless DEFAULT specification in plpgsql variable declarations 2014-06-11 11:25:25 +02:00
Sandro Santilli
f75c256b6e Another full qualification of CDB_TransformToWebmercator in CDB_CartodbfyTable 2014-06-06 18:09:41 +02:00
Sandro Santilli
d52556c20e Fully qualify call to CDB_TransformToWebmercator from CDB_CartodbfyTable 2014-06-06 17:28:43 +02:00
Sandro Santilli
f8180123eb Grant permission to run table-info functions to public
This is needed as a way to migrate from versions < 0.2.0
See #36
2014-06-06 11:36:19 +02:00
Sandro Santilli
01ae7b8c10 Drop role management
Roles are not created anymore, previously private functions for table
information extraction (CDB_UserTables, CDB_TableIndexes, CDB_ColumnNames,
CDB_ColumnType) will now be callable by anyone while only returning
information about tables over which the calling user has SELECT privilege.

Closes #36
2014-06-06 11:02:51 +02:00
Sandro Santilli
f9f73d2d62 Fix potential infinite loop in CDB_QueryStatements
This fix was already present at one point in cartodb/lib/sql
(where the code was copied from) but in a different branch than
the one the code was initially copied from.

The fix depends on plpython language which becomes a new dependency.
2014-06-05 15:00:57 +02:00
Sandro Santilli
a92d7d7d37 Add cdb_extension_reload() utility function 2014-06-04 10:31:03 +02:00
Sandro Santilli
ce20009fb2 Workaround PostgreSQL bug possibly triggering infinite loops
Implements casting of existing system column values during
cartodbfication using ALTER rather than UPDATE.

It's faster for tables with many rows and works around a
longstanding PostgreSQL bug. See
http://www.postgresql.org/message-id/20140530143150.GA11051@localhost

CDB-3059
2014-05-30 19:24:19 +02:00
Sandro Santilli
cc9cbdb7a7 Typo 2014-05-30 18:35:08 +02:00
Sandro Santilli
ac53d6b000 Formatting only change 2014-05-30 12:22:54 +02:00
Sandro Santilli
f5ad0d0434 Fully qualify call to CDB_UserDataSize from quota trigger 2014-05-28 17:42:11 +02:00
Sandro Santilli
bfd56f0ea6 Fully qualify call to cdb_disable_ddl_hooks from cdb_enable_ddl_hooks 2014-05-28 12:53:22 +02:00
Sandro Santilli
004c3c5543 Ensure cartodb_id uses an associated sequence
Closes #33
2014-05-28 10:45:42 +02:00
Sandro Santilli
2601364011 Fix recursive DDL trigger on create table
Closes #32
2014-05-28 09:02:02 +02:00
Sandro Santilli
09cf368d62 Move DDL triggers and extension postamble under scripts-available
Target 0.2.0
2014-05-23 17:40:14 +02:00
Sandro Santilli
348177d23a Fix cartodbfication of already-cartodbfied tables in presence of views
Closes #30
Includes testcase
2014-05-23 16:54:36 +02:00
Sandro Santilli
102e8bd018 Improve error message on failing CDB_CartodbfyTable 2014-05-23 16:04:54 +02:00
Sandro Santilli
967b7abec0 Try to retain existing cartodb_id values
Also reset sequence when original cartodb_id values correctly
cast to integers, and does not keep a backup in that case.

Closes #27
2014-05-22 14:11:09 +02:00
Sandro Santilli
134d2d29b6 Try to cast TEXT typed updated_at and created_at if present
If the cast fails we'll still rename those fields and create
new ones. See #27 (cartodb_id is still not done)
2014-05-22 13:10:42 +02:00
Sandro Santilli
0082138503 Do not force DROP FUNCTION but rely on CREATE OR REPLACE
We'll bet on no old signature being left around.

Presence of an old signature would break at runtime
with a message like:
ERROR:  function CDB_UserTables() is not unique

Closes #25
2014-05-20 16:39:18 +02:00
Sandro Santilli
2f0031e6a2 Do not call CDB_Invalidate_Varnish() if not owned by a superuser
Search for that function in schemas cartodb and public (in that order).
Closes #24
2014-05-14 19:03:20 +02:00
Sandro Santilli
8d6188e282 Have _CDB_UserQuotaInBytes() take precedence over parameter-based quota
Closes #16
2014-05-12 13:37:47 +02:00
Sandro Santilli
f98071cdac Do not allow cartodbfying tables while no user quota is set
Closes #17
Updates tests
2014-05-12 13:27:44 +02:00
Sandro Santilli
cfd8dbc5a4 Test calls to CDB_Invalidate_Varnish
Also drops the DELETE trigger on CDB_TableMetadata as the call to
CDB_Invalidate_Varnish would then get an OID, which is pretty useless.
Closes #8
2014-05-09 17:34:18 +02:00
Sandro Santilli
b69ded8f66 Let CDB_CheckQuota second parameter override configured user quota
Closes #13
Includes automated test
2014-05-09 12:55:41 +02:00
Sandro Santilli
30186ac8cb Pretend _CDB_UserQuotaInBytes has to stay in public
Fixes run of the testsuite in the pre-extension model
2014-05-08 17:20:40 +02:00
Sandro Santilli
acf3097c3a Add CDB_SetUserQuotaInBytes function
Closes #2
2014-05-08 17:14:06 +02:00
Sandro Santilli
055efe04aa Do not assume existance of a "publicuser" role in CDB_UserTables
Closes #5 (take 2)
2014-05-08 16:42:38 +02:00
Sandro Santilli
9b6f9e21f2 Stick with user tables being in public
... but workaround extension code replacing "public." with "cartodb."
2014-05-06 10:53:19 +02:00
Sandro Santilli
15740f2ef6 Enable running all tests via "installcheck"
NOTE: also makes CDB_TableMetadata triggers still functional
      when user quota and varnish invalidation functions are missing
      from the database (currently installed by cartodb ruby)
2014-05-06 10:18:38 +02:00
Sandro Santilli
0960276046 Import cartodb/lib/sql/test, add search_path tweaker 2014-05-05 18:48:48 +02:00
Sandro Santilli
5e28417b3d Add "cdb_org_admin" and "cdb_org_user" roles as part of extension 2014-05-05 18:04:14 +02:00
Sandro Santilli
2f1fdf5a15 Copy cartodb lib/sql scripts from CDB_CartodbfyTable branch 2014-05-05 17:13:06 +02:00