Skip to content
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

SQL Error [22023]: ERROR: label_id must be 1 .. 65535 #1837

Open
devcode100 opened this issue May 6, 2024 · 10 comments
Open

SQL Error [22023]: ERROR: label_id must be 1 .. 65535 #1837

devcode100 opened this issue May 6, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@devcode100
Copy link

devcode100 commented May 6, 2024

Describe the bug
Upon trying to create new Nodes, getting the below error:
SQL Error [22023]: ERROR: label_id must be 1 .. 65535
The issue is very specific to Nodes whose Labels are already existing, If I try to create Nodes with new Labels, no issues.
The volume of data is <100 (total number of Nodes across various Labels).
There is no steps I could think of to replicate this issue, it came randomly and exists.

How are you accessing AGE (Command line, driver, etc.)?

  • DBeaver, AGE Viewer

What is the necessary configuration info needed?

  • Postgres 16

What is the command that caused the error?

SELECT * FROM cypher('SchemaGraph', $$
CREATE (:Category {name: 'CategoryTest1'})
CREATE (:Category {name: 'CategoryTest2'})
$$) AS (n agtype);
SQL Error [22023]: ERROR: label_id must be 1 .. 65535

Expected behavior
The Nodes should have been created.

Environment (please complete the following information):

  • Release v1.5.0 for PG16

Additional context
Add any other context about the problem here.

@devcode100 devcode100 added the bug Something isn't working label May 6, 2024
@jrgemignani
Copy link
Contributor

jrgemignani commented May 6, 2024

The volume of data is <100 (total number of Nodes across various Labels).

Roughly, how many distinct labels?

Edit: Additionally, how are you inserting all of these nodes

@devcode100
Copy link
Author

devcode100 commented May 7, 2024

The volume of data is <100 (total number of Nodes across various Labels).

Roughly, how many distinct labels?

   SELECT count(id) FROM ag_catalog.ag_label al; --26
   SELECT max(id) FROM ag_catalog.ag_label al ; --26

There is roughly 26 distinct labels.(The size of data set is very small).

Edit: Additionally, how are you inserting all of these nodes
I am not doing any bulk insertions rather very simple node creations.
E.g:- The below query will create issue

SELECT * FROM cypher('SchemaGraph', $$
CREATE (:Category {name: 'CategoryTest1'})
$$) AS (n agtype);

The issue is very specific to Nodes whose Labels are already existing, If I try to create Nodes with new Labels, no issues.

@jrgemignani
Copy link
Contributor

jrgemignani commented May 7, 2024

@devcode100 This is happening when using the command line in PostgreSQL? Or through a driver?

@devcode100
Copy link
Author

@jrgemignani , Both through psql cli and DBearver(SQL GUI Client), getting the issue.

@jrgemignani
Copy link
Contributor

@devcode100 I have not been able to reproduce this and I created 120,000 nodes as shown below, in both the latest and PG16 release 1.5.0. It could be that your install got messed up?

psql-16.1-5432-pgsql=# DO
$do$
BEGIN
    FOR i in 1..100000 LOOP
        PERFORM * FROM cypher('test', $$ CREATE (:Category {name: 'CategoryTest1'}) CREATE (:Category {name: 'CategoryTest2'}) CREATE (:Category2 {name: 'CategoryTest1'}) CREATE (:Category2  {name: 'CategoryTest2'}) $$) AS (n agtype);
end LOOP;
end
$do$;
DO
psql-16.1-5432-pgsql=# DO
$do$
BEGIN
    FOR i in 1..100000 LOOP
        PERFORM * FROM cypher('test', $$ CREATE (:Category {name: 'CategoryTest1'}) CREATE (:Category {name: 'CategoryTest2'}) CREATE (:Category2 {name: 'CategoryTest1'}) CREATE (:Category2  {name: 'CategoryTest2'}) $$) AS (n agtype);
end LOOP;
end
$do$;
DO
psql-16.1-5432-pgsql=# DO
$do$
BEGIN
    FOR i in 1..100000 LOOP
        PERFORM * FROM cypher('test', $$ CREATE (:Category {name: 'CategoryTest1'}) CREATE (:Category {name: 'CategoryTest2'}) CREATE (:Category2 {name: 'CategoryTest1'}) CREATE (:Category2  {name: 'CategoryTest2'}) $$) AS (n agtype);
end LOOP;
end
$do$;
DO
psql-16.1-5432-pgsql=# select * from cypher('test', $$ match (u) return count(u) $$) as (result agtype);
 result
---------
 1200000
(1 row)

psql-16.1-5432-pgsql=#

@jrgemignani
Copy link
Contributor

jrgemignani commented May 8, 2024

@devcode100 I should note that, for each of my tests, I used fresh installs of PostgreSQL version 16.1 and Apache AGE master and release 1.5.0. I'm not sure what specific version of 16 you are using, though.

Here I have created over 13M nodes without issue -

psql-16.1-5432-pgsql=# select * from cypher('test', $$ match (u) return count(u) $$) as (result agtype);
  result
----------
 13600000
(1 row)

psql-16.1-5432-pgsql=#

I think your install might be bad.

psql-16.1-5432-pgsql=# select * from cypher('test', $$ match (u) return count(u) $$) as (result agtype);
  result
----------
 53600000
(1 row)

psql-16.1-5432-pgsql=#

@devcode100
Copy link
Author

devcode100 commented May 8, 2024

@jrgemignani , appreciate your effort to replicate.

SELECT version();
//PostgreSQL 16.2 (Ubuntu 16.2-1.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
Using `Windows Subsystem for Linux` for local setup.

The current postgres server setup have is a single node one and I haven't encountered any issues with DB so far.
I would suggest to keep the issue open(at least till ~2 releases ) as its critical for us to monitor the AGE extension as we are planning to move to production with the same.

@jrgemignani
Copy link
Contributor

@devcode100 I have tried this against PostgreSQL version 16.2 and the master branch, without issue -

psql-16.2-5432-pgsql=# drop extension age; create extension age; load 'age'; set search_path TO ag_catalog;
DROP EXTENSION
CREATE EXTENSION
LOAD
SET
psql-16.2-5432-pgsql=# select * from create_graph('test');
NOTICE:  graph "test" has been created
 create_graph
--------------

(1 row)

psql-16.2-5432-pgsql=# DO
$do$
BEGIN
    FOR i in 1..10000000 LOOP
        PERFORM * FROM cypher('test', $$ CREATE (:Category {name: 'CategoryTest1'}) CREATE (:Category {name: 'CategoryTest2'}) CREATE (:Category2 {name: 'CategoryTest1'}) CREATE (:Category2  {name: 'CategoryTest2'}) $$) AS (result agtype);
end LOOP;
end
$do$;
DO
psql-16.2-5432-pgsql=# select * from cypher('test', $$ match (u) return count(u) $$) as (result agtype);
  result
----------
 40000000
(1 row)

psql-16.2-5432-pgsql=#

@jrgemignani
Copy link
Contributor

@devcode100 I have tried this against PostgreSQL version 16.2 and release 1.5.0, without issue -

psql-16.2-5432-pgsql=# drop extension age; create extension age; load 'age'; set search_path TO ag_catalog;
DROP EXTENSION
CREATE EXTENSION
LOAD
SET
psql-16.2-5432-pgsql=# select * from create_graph('test');
NOTICE:  graph "test" has been created
 create_graph
--------------

(1 row)

psql-16.2-5432-pgsql=# DO
$do$
BEGIN
    FOR i in 1..10000000 LOOP
        PERFORM * FROM cypher('test', $$ CREATE (:Category {name: 'CategoryTest1'}) CREATE (:Category {name: 'CategoryTest2'}) CREATE (:Category2 {name: 'CategoryTest1'}) CREATE (:Category2  {name: 'CategoryTest2'}) $$) AS (result agtype);
end LOOP;
end
$do$;
DO
psql-16.2-5432-pgsql=# select * from cypher('test', $$ match (u) return count(u) $$) as (result agtype);
  result
----------
 40000000
(1 row)

psql-16.2-5432-pgsql=#

@devcode100
Copy link
Author

@jrgemignani - I have dropped the Graph where I got the issue and working on new Graph schema now. I have not encountered the issue so far.
But to be frank the issue seemed weird and I still feel there is a corner case which triggers the issue.
Even I couldn't replicate the issue( means in the new Graph).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants