You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "JourneyToSilius (via GitHub)" <gi...@apache.org> on 2024/05/06 12:56:02 UTC
[I] SQLSTATE 22003 when trying to insert a numeric value [age]
JourneyToSilius opened a new issue, #1836:
URL: https://github.com/apache/age/issues/1836
`ERROR: value "3082705652732369514543573" is out of range for type bigint (SQLSTATE 22003)`
I get this error when I try to insert a really large integer, it seems that age can't infer the type correctly, since this should be a numeric type in postgres. I have tried to type cast it to numeric ( this is on a prepared statement ) but it doesn't work. Is there any work around for this, or should this be stored as string ? Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "JourneyToSilius (via GitHub)" <gi...@apache.org>.
JourneyToSilius commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2097049632
@jrgemignani :
```
{"largeint":"3082705652732369514543573::numeric","name":"test_struct"}
--- PASS: TestInferTypeInquery (0.04s)
--- PASS: TestInferTypeInquery/Test_build_query_with_inferred_type (0.01s)
PASS
```
works now. I was attempting to add the typecast in the actual prepared statement instead of in the JSONB, so it was my confusion. Thank you for your help
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2096428468
@JourneyToSilius I will have to look at how that JSON is decoded. It might be that PG JSON doesn't support numeric. It might be that we added numeric and it needs a cast.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2097052243
@JourneyToSilius yw!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "JourneyToSilius (via GitHub)" <gi...@apache.org>.
JourneyToSilius commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2106383233
I just realized I am inserting this : `{"largeint":"3082705652732369514543573::numeric","name":"test_struct"}` which means it's a string, and not a numeric type ? I'm I right ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2096381218
@JourneyToSilius Could you provide the query and output?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "JourneyToSilius (via GitHub)" <gi...@apache.org>.
JourneyToSilius commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2096453386
I tried to type cast it to numeric but it doesn't work, or at least not the way I was doing it. Otherwise I'm not sure if JSONB actually supports numeric or it must be passed as string ... will wait for your response @jrgemignani thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "jrgemignani (via GitHub)" <gi...@apache.org>.
jrgemignani commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2096929348
@JourneyToSilius Try something like the following -
```
psql-16.1-5432-pgsql=# SELECT * FROM cypher('test', $$ CREATE (a:simplestruct {largeint: 123456789012345678901234567890::numeric, name: 'name'}) RETURN a $$) AS (a agtype);
a
------------------------------------------------------------------------------------------------------------------------------------
-----------
{"id": 844424930131969, "label": "simplestruct", "properties": {"name": "name", "largeint": 123456789012346000000000000000::numeric
}}::vertex
(1 row)
psql-16.1-5432-pgsql=#
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "JourneyToSilius (via GitHub)" <gi...@apache.org>.
JourneyToSilius commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2096968438
@jrgemignani thanks, that's what I tried before. If it works at the CLI it must be a string formatting problem then. I will try this out tomorrow and debug what's going on
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "JourneyToSilius (via GitHub)" <gi...@apache.org>.
JourneyToSilius closed issue #1836: SQLSTATE 22003 when trying to insert a numeric value
URL: https://github.com/apache/age/issues/1836
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] SQLSTATE 22003 when trying to insert a numeric value [age]
Posted by "JourneyToSilius (via GitHub)" <gi...@apache.org>.
JourneyToSilius commented on issue #1836:
URL: https://github.com/apache/age/issues/1836#issuecomment-2096406184
Query:
`SELECT * FROM cypher('test_graph', $$CREATE (a:simplestruct {largeint: $largeint, name: $name})$$, $1::agtype) AS (n agtype);`
AgeMap : `{"largeint":3082705652732369514543573,"name":"test_struct"}`
executed as :
```
return func(ctx context.Context, conn postgres.DBTX) (pgconn.CommandTag, error) {
return conn.Exec(ctx, wrapped, g.vertexData.AgeMap)
}
```
result :
```
Error: Received unexpected error:
ERROR: value "3082705652732369514543573" is out of range for type bigint (SQLSTATE 22003)
Test: TestInferTypeInquery/Test_build_query_with_inferred_type
--- FAIL: TestInferTypeInquery (0.05s)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@age.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org