Skip to content

Postgres materialized views problem #1021

Description

@basilex

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!

Activity

  1. kyleconroy commented on Jun 25, 2021

    @kyleconroy
    Collaborator

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

  2. prog8 commented on Mar 4, 2022

    @prog8

    Is there any plan to add materialized view support?

  3. ludusrusso commented on Mar 22, 2022

    @ludusrusso
    Contributor

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

  4. kyleconroy commented on Mar 24, 2022

    @kyleconroy
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions