-
CockroachDB cannot refresh {% if page.name == "views.md" %} materialized views {% else %} [materialized views]({% link {{ page.version.version }}/views.md %}#materialized-views) {% endif %} inside [explicit transactions]({% link {{ page.version.version }}/begin-transaction.md %}). Trying to refresh a materialized view inside an explicit transaction will result in an error.
-
Start [
cockroach demo]({% link {{ page.version.version }}/cockroach-demo.md %}) with the samplebankdata set:{% include_cached copy-clipboard.html %}
cockroach demo bank
-
Create the materialized view described in [Usage]({% link {{ page.version.version }}/views.md %}#usage).
-
Start a new multi-statement transaction with [
BEGIN TRANSACTION]({% link {{ page.version.version }}/begin-transaction.md %}):{% include_cached copy-clipboard.html %}
BEGIN TRANSACTION; -
Inside the open transaction, attempt to [refresh the view]({% link {{ page.version.version }}/refresh.md %}). This will result in an error.
{% include_cached copy-clipboard.html %}
REFRESH MATERIALIZED VIEW overdrawn_accounts;
ERROR: cannot refresh view in an explicit transaction SQLSTATE: 25000
Tracking GitHub Issue
-