dosco / graphjin

GraphJin - Build NodeJS / GO APIs in 5 minutes not weeks

Home Page:https://graphjin.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

configuration defined OrderBy + cursor combo not working

LucaWolf opened this issue · comments

What version of GraphJin are you using? graphjin version

core/v3 v3.0.0-20240503072632-ee9ecd63cbc1

Have you tried reproducing the issue with the latest release?

Believed latest? used go mod tidy to pick the default,

What is the hardware spec (RAM, OS)?

Amazon Linux, 4gb small instance

Steps to reproduce the issue (config used to run GraphJin).

Using configuration:

var configuration = core.Config{
	EnableSchema: true,
	DefaultLimit: 100,
	Tables: []core.Table{
          {
	    Name: "uploads",
	    OrderBy: map[string][]string { // some sorting defaults
		"id_asc":  {"event_id asc"},
		"id_desc": {"event_id desc"},
	    },
	  },
        },
}

A. this works :-)

query Events {
	uploads(
		where: { source_id: { equals: 101 } },
		first: 3,
		orderBy: {event_id: desc},
		before: $cursor
	) {
		event_id
		registered_on
	}
}

B. this doesn't work :-(

query Events {
	uploads(
        	where: { source_id: { equals: 101 } },
  		first: 3,
  		orderBy: $order_param,
		before: $cursor
	) {
		event_id
		registered_on
	}
}

query data

{
	"order_param": "id_desc",
	"cursor": "__gj/enc:NP+CG9Y......."
}

Expected behavior and actual result.

Expecting to get the same result in both (A) and (B) cases as they should compile to the same underlying SQL.
Actual result (B):

{
  "errors": [
	{ "message": "pq: column reference \"event_id\" is ambiguous" }
  ]
}

Note: (B) works with orderBy alone, i.e. without before: $cursor. It seem the combo trips it.

commented

will take a look

commented

new release with fix pushed

thank you.