Commit graph

62 commits

Author SHA1 Message Date
Yugo Nagata
6439e8c7be Bump up the version 1.1 to 1.2 2022-07-28 21:29:12 +09:00
Yugo Nagata
7c7f2de5a5 Remove tailing tab space 2022-07-25 17:40:01 +09:00
Yugo Nagata
73b2fc216e Fix types in README 2022-07-25 17:37:22 +09:00
Yugo Nagata
cfe9491e6b Fix README for pg_ivm 1.2 2022-07-25 17:31:46 +09:00
Yugo Nagata
6dcfb31848 Update to 1.2 2022-07-25 15:21:38 +09:00
Yugo Nagata
f1e36a9781 Add regression tests for some cases
Per sub-queries support, a test for join with subquery is added.
In passing, the order of tests are fixed with according to that in pgsql-ivm.
Also, some other tests related to aggregates and sub-queries are added.
2022-07-25 15:14:40 +09:00
Yugo Nagata
6faf0b3baa
Support min/max aggregates (#18)
In order to re-calculate min/max values for groups where the min
or max value is deleted, we need the view query definition in string
form. However, pg_get_viewdef cannot be used for this purpose because
IMMV's defenition is in pg_ivm_immv but not pg_rewrite.  Therefore,
we have to convert query definition in pg_ivm_immv to query
definition string. We can use pg_get_querydef in PG15, but we cannot
in PG14 or earlier, so we use codes in ruleutil.c copied from PG13
or PG14 depending versions.
2022-07-25 13:11:33 +09:00
thoshiai
790b0d2bd6
Support simple subquery (#17)
A simple subquery in FROM clause is supported.
DISTINCT and aggregate functions are not supported in subquery.
2022-07-25 09:24:51 +09:00
thomas.boussekey
75ee63b99a
Fix minor typos in README (#16) 2022-07-21 23:38:26 +09:00
thoshiai
2ead2e207e
Add support for PostgreSQL 15 (#15) 2022-07-14 22:54:33 +09:00
Yugo Nagata
d7d1fb0f49 Update to 1.1 2022-06-23 11:48:07 +09:00
Yugo Nagata
3de95c09fa Improve refresh_immv behavior a bit
- Allow to use qualified name
- Confirm if executed by the owner of the IMMV
- Improve the message when specified relation is not an IMMV
- Create a unique index at refresh with no dat if possible
  This is actually required, but we want it behave as same
  as the pgsql-ivm version for now.
2022-06-23 11:33:06 +09:00
Yugo Nagata
1c4408199c Fix error codes for invalid input to create_immv 2022-06-22 17:59:20 +09:00
Yugo Nagata
279b14049e
Update README.md
Add description about how to disable or enable IVM
2022-06-22 16:41:33 +09:00
Yugo Nagata
384347fdeb
Update README for pg_ivm 1.1
Add description about aggregates, TRUNCATE, and refresh_immv.
2022-06-22 16:09:04 +09:00
Yugo Nagata
53c9509163 Fix check for aggregate functions to work with PostgreSQL 13
In PostgreSQL 14 or later, OIDs of aggregate functions are
described in fmrgoids.h, but that in PostgreSQL 13 doesn't
contain aggregate function OIDs. Therefore, we get the OID
by passing the function name and arg type to to_regprocedure().
2022-06-21 23:08:54 +09:00
Yugo Nagata
d99aeb848e Allow TRUNCATE on base tables (#144)
When a base table is truncated, the view content will be empty if the
view definition query does not contain an aggregate without a GROUP clause.
Therefore, such views can be truncated.

Aggregate views without a GROUP clause always have one row. Therefore,
if a base table is truncated, the view will not be empty and will contain
a row with NULL value (or 0 for count()). So, in this case, we refresh the
view instead of truncating it.
2022-06-21 21:27:21 +09:00
Yugo Nagata
57c8bac1a0 Add aggregates support
Built-in count, sum, avg are supported. We have not supported min/max
yet, but will support in future.

When an IMMV with any aggregates are defined, additional columns
are created for each aggregate function. Although such columns are
"hidden" in pgsql-ivm version, they are always visible for users
in the extension version.
2022-06-21 20:50:45 +09:00
Yugo Nagata
1e80a34a86 Move the new function and catalog attributes to a update script 2022-06-16 10:07:54 +09:00
thoshiai
51a944b388 Add refresh_immv() function
refresh_immv(immv_name, with_data) is a function to refresh IMMV like
 REFRESH MATERIALIZED VIEW command. It has two argument.
immv_name is incrementally maintainable materialized view's name, and
with_data is an option that is corresponding to the WITH [NO] DATA option.
When with_data is set false, the IMMV gets unpopulated.

One of differences between IMMVs unpopulated by this function and
normal materialized views unpopulated by REFRESH ... WITH NO DATA
is that such IMMVs can be referenced by SELECT but return no rows,
while unpopulated materialized views are not scanable.

The behaviour may be changed in future to raise an error when unpopulated
an IMMV is scanned.
2022-06-16 03:06:47 +09:00
Yugo Nagata
7ab42004d2
Merge pull request #12 from sraoss/11-pg_ivm-test-fails-on-postgresql-15-beta1
Fix the test to grant create permissions on the public schema
2022-06-13 13:25:49 +09:00
Yugo Nagata
a37de7aa7a
Merge pull request #13 from tatsuo-ishii/README_fix
Mention that pg_ivm is compatible with PostgreSQL 13 in addition to 
PostgreSQL 14.
2022-06-13 09:35:48 +09:00
Tatsuo Ishii
7868c7b923 Mention that pg_ivm is compatible with PostgreSQL 13 in addition to PostgreSQL 14. 2022-06-11 18:57:14 +09:00
Yugo Nagata
a75443f8ea Fix the test to grant create permissions on the public schema
As of PG15, PUBLIC CREATE was revoked from public schema, so
we have to grant it in contrib_regression database.
2022-06-03 15:53:41 +09:00
Yugo Nagata
9719ed644d
Merge pull request #10 from tatsuo-ishii/rel13
Allow to build pg_ivm on PostgreSQL 13.
2022-06-02 14:46:59 +09:00
Yugo Nagata
42a5bcd24e Fix pg_ivm.spec take2 2022-06-02 12:04:55 +09:00
Yugo Nagata
575e8ff0ac Fix spec file 2022-06-02 11:27:41 +09:00
Tatsuo Ishii
612b59694e Allow to build pg_ivm on PostgreSQL 13. 2022-05-17 21:32:04 +09:00
Yugo Nagata
ad0d36220f
Update README.md 2022-05-12 16:25:15 +09:00
Yugo Nagata
0a99573ff3
Update README.md 2022-05-12 16:22:13 +09:00
Yugo Nagata
5776ea3aa6
Update README.md 2022-05-12 16:15:46 +09:00
Yugo Nagata
0c44342ba8
Update README.md 2022-05-12 16:14:36 +09:00
Yugo Nagata
f4579fa3fc
Merge pull request #8 from sraoss/header
Fix a header guard macro. Reported by Issue #6.
2022-05-03 03:24:39 +09:00
Yugo Nagata
0b2f41d82a Fix a header gurad macro 2022-05-03 03:19:58 +09:00
Yugo Nagata
489af72ed4 Fix pg_ivm.spec 2022-05-03 03:16:29 +09:00
Yugo Nagata
c9730b8907 Merge branch 'main' of https://github.com/sraoss/pg_ivm into main 2022-05-03 02:37:39 +09:00
Yugo Nagata
5b6a0bc6d2 Add pg_ivm.spec 2022-05-03 02:37:24 +09:00
Yugo Nagata
039f15c783
Merge pull request #7 from fjf2002/patch-1
Update README.md
2022-05-02 18:01:31 +09:00
fjf2002
8374ae71b5
Update README.md
Typo fixed
2022-05-02 11:00:18 +02:00
Yugo Nagata
f2d43bb923 Fix to delete the pg_ivm_immv entry when an IMMV is dropped 2022-04-28 19:47:30 +09:00
Yugo Nagata
f68e04524b Fix to parse relname and column in create_immv arguments
It enables earlier checks for invalid inputs.
2022-04-28 18:59:48 +09:00
Yugo Nagata
ab1bc09d8e
Split files for ease of following the changes of the core code
createas.c and matview.c contain corresponding functions that are
defined in the same name files in the core version. pg_ivm.c contains
user interface functions and callback functions.

The file names are identical to those in the core code  ( in pgsql-ivm 
repository) and  some codes are copied from it so that we can easily 
compare the code between the extension and the core. That is because
we would like to apply features in this extension to the core as a new 
feature in future. Also, we plan to adopt the core code change to the 
extension to prevent the difference from being too far. However, 
considering modularity or code-readability, it is possible that we may change this policy in future.

In passing, Makefile is also fixed and we don't need to use
USE_PGXS now.
2022-04-27 23:15:58 +09:00
Yugo Nagata
2255a73ff1
Update README.md 2022-04-27 15:08:01 +09:00
Yugo Nagata
eed6271128 Split files to make it easier to follow the core code 2022-04-27 14:45:47 +09:00
Yugo Nagata
f586a03716
Update README.md 2022-04-15 09:44:31 +09:00
Yugo Nagata
34c44eb4b1
Update README.md 2022-04-14 16:58:25 +09:00
Yugo Nagata
0a5f018fb9
Update README.md 2022-04-13 14:40:36 +09:00
Yugo Nagata
79693823d7
Merge pull request #3 from marcocitus/patch-1
Make create_immv STRICT
2022-04-08 18:44:23 +09:00
Marco Slot
61c93dc2dc
Make create_immv STRICT
This currently crashes the server: `SELECT create_immv(NULL, 'SELECT * FROM test');` . Marking the function STRICT will avoid calling it with NULL arguments.

Alternative would be check for NULLs in create_immv.
2022-04-01 15:14:15 +02:00
Yugo Nagata
9f02dc84dd
Merge pull request #2 from hanefi/patch-1
Fix simple typos in README
2022-04-01 22:01:46 +09:00