graphprotocol / graphprotocol/graph-node

[Bug] graphman sometimes creates the wrong index

Open
#5,130 4 comments 0 reactions 1 assignee View on GitHub

@incrypto32 is already working on this.

Since Jan 10, 2024.

bug
Dominant language
Rust
Stars
3.2k
Forks
1.1k
Avg merge
4d 1h
Merged PRs (30d)
1

Description

Bug report

The following graphman command resulted in an unexpected index:

graphman index create sgd647572 pool_hour_data pool
Index creation started. Please wait.
Index creation completed.

Listing information about the table in the DB showed the following index having been created:

=> \d sgd647572.pool_hour_data
                                          Table "sgd647572.pool_hour_data"
         Column          |   Type    | Collation | Nullable |                        Default                        
-------------------------+-----------+-----------+----------+-------------------------------------------------------
 vid                     | bigint    |           | not null | nextval('sgd647572.pool_hour_data_vid_seq'::regclass)
 block_range             | int4range |           | not null | 
 id                      | text      |           | not null | 
 period_start_unix       | integer   |           | not null | 
 pool                    | text      |           | not null | 
 [...]
Indexes:
    "pool_hour_data_pkey" PRIMARY KEY, btree (vid)
    "attr_15_0_pool_hour_data_id" btree (id)
[...]
    "attr_15_9_pool_hour_data_fee_growth_global_1x128" btree (fee_growth_global_1x128)
    "brin_pool_hour_data" brin (lower(block_range) int4_minmax_multi_ops, COALESCE(upper(block_range), 2147483647) int4_minmax_multi_ops, vid int8_minmax_multi_ops)
    "manual_pool_hour_data_pool" btree (pool, block_range)
    "pool_hour_data_block_range_closed" btree (COALESCE(upper(block_range), 2147483647)) WHERE COALESCE(upper(block_range), 2147483647) < 2147483647
    "pool_hour_data_id_block_range_excl" gist (id, block_range)

I saw this behaviour earlier on other SGs as well, in one case on a token table.

Relevant log output

No response

IPFS hash

QmZeCuoZeadgHkGwLwMeguyqUKz1WPWQYKcKyMCeQqGhsF

Subgraph name or link to explorer

No response

Some information to help us out
  • Tick this box if this bug is caused by a regression found in the latest release.
  • Tick this box if this bug is specific to the hosted service.
  • I have searched the issue tracker to make sure this issue is not a duplicate.
OS information

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.