Skip to content

Postgres materialized views problem #1021

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
basilex opened this issue May 18, 2021 · 4 comments · Fixed by #1509
Closed

Postgres materialized views problem #1021

basilex opened this issue May 18, 2021 · 4 comments · Fixed by #1509
Labels
📚 postgresql enhancement New feature or request

Comments

@basilex
Copy link

basilex commented May 18, 2021

Hi!
Help needed.

SQLC 1.8.0
Database PostgreSQL 13.2

I have materialized view as shown below:

create materialized view m_lentities_assets as
    select l.id             as lentity_id,
           l.short_name     as lentity_short_name,
           l.full_name      as lentity_full_name,
           l.status         as lentity_status,
           m.role_id        as lentity_role_id,
           a.id             as asset_id,
           a.parent_id      as asset_parent_id,
           a.atypes_id      as asset_atypes_id,
           a.name           as asset_name,
           a.status         as asset_status
      from lentities l,
           assets a,
           lentity_assets m
     where m.lentity_id = l.id
       and m.asset_id = a.id
      with no data;

refresh materialized view m_lentities_assets;

and query respectively:

-- name: MLentitiesAssetsGet :many
select *
  from m_lentities_assets
 order by @sql_order::text
 limit @sql_limit offset @sql_offset;

but im unlucky yet...
Even for the read only selects i can't generate any result...

docker run --rm -v /Users/Stalker/workspace/src/gitlab.com/company/be:/src -w /src kjconroy/sqlc generate
# package dbs
storage/query/m_lentities_assets.sql:1:1: relation "m_lentities_assets" does not exist
make: *** [generate-dbs] Error 1

Any help would be appreciated.
Thanx!

@kyleconroy kyleconroy added the enhancement New feature or request label Jun 25, 2021
@kyleconroy
Copy link
Collaborator

View support was added in #1044. Materialized view support has not been added yet.

@prog8
Copy link

prog8 commented Mar 4, 2022

Is there any plan to add materialized view support?

@ludusrusso
Copy link
Contributor

Is there someone on this issue? @kyleconroy I could try to work on a PR if is ok for you!

@kyleconroy
Copy link
Collaborator

Sure! Would love to support this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 postgresql enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants