graphprotocol / graphprotocol/graph-node

[Bug] Sorting subgraphs by nested FDS field throws error

Open
#5,168 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Bug report

Querying the graph-network arbitrum subgraph and sorting by metadata__displayName; throws an error (see log output).
There was a recent change to the network subgraph to support File Data Services; this change moved the displayName field from the top-level Subgraph entity to be in a nested SubgraphMetadata entity that is controlled by FDS.
Sorting by any field in the metadata entity throws this error.

Relevant log output
Results in this error message from graph-node


message: `Failed to get entities from store: column cc.block_range does not exist, query = /* controller='filter',application='sgd675036',route='d8217ff92881cd2a-9ef95e8b5fa290fd',action='174820478' */\nselect 'Subgraph' as entity, to_jsonb(c.*) as data from (select c.*\n from "sgd675036"."subgraph" c left join "sgd675036"."subgraph_metadata" as cc on (cc."id" = c."metadata" and cc."block_range" @> $1) \n where c.block_range @> $2 and (c."active" = $3 and c."entity_version" = $4 and exists (select 1 from "sgd675036"."subgraph_metadata" as i where i."id" = c."metadata" and i.block$ <= $5 and (left("display_name", 256) != left($6, 256))))\n\n order by cc."display_name" asc, c."id" asc\n limit 20) c -- binds: [174820478, 174820478, true, 2, 174820478, ""]
IPFS hash

No response

Subgraph name or link to explorer

https://api.thegraph.com/subgraphs/name/graphprotocol/graph-network-arbitrum

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.

Research direction

Start by reproducing the linked GraphQL query against the graph-network arbitrum subgraph and inspect the graph-node store query shown in the log, especially the join to subgraph_metadata and its block_range condition. Trace how sorting by nested metadata fields is generated; done means nested-field sorting no longer produces the missing-column error and the reported query returns results.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, rust
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.