Allison-E / pg-age

Apache License 2.0
11 stars 5 forks source link

Not working with the docker version of Age #2

Closed paule96 closed 9 months ago

paule96 commented 9 months ago

hi,

I currently try to play around with pg-age and dotnet. So I found this library. Because playing around with docker is easy, I use the official docker image apache/age. This has a preconfigured postgre with the age extension installed.

I started to try the extension and couldn't read the data. The issue is, that to use age you need to load the extension into the query context and also add the ag_catalog.

LOAD 'age';
SET search_path = ag_catalog, "$user", public;

Note: The docs explicit points that out here.

So I just added this loading to my query like that:

await client.ExecuteQueryAsync("LOAD 'age';SET search_path = ag_catalog, \"$user\", public;");
await client.ExecuteCypherAsync("graph1", "CREATE (:Person {age:23}), (:Person {age:78})");

If I do that I get the following error:

ApacheAGE.AgeException: Could not execute Cypher command.
 ---> Npgsql.NpgsqlOperationInProgressException (0x80004005): A command is already in progress: LOAD 'age';SET search_path = ag_catalog, "$user", public;
   at Npgsql.ThrowHelper.ThrowNpgsqlOperationInProgressException(NpgsqlCommand command)
   at Npgsql.Internal.NpgsqlConnector.<StartUserAction>g__DoStartUserAction|279_0(ConnectorState newState, NpgsqlCommand command, CancellationToken cancellationToken, Boolean attemptPgCancellation)
   at Npgsql.Internal.NpgsqlConnector.StartUserAction(ConnectorState newState, NpgsqlCommand command, CancellationToken cancellationToken, Boolean attemptPgCancellation)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteReader(Boolean async, CommandBehavior behavior, CancellationToken cancellationToken)
   at Npgsql.NpgsqlCommand.ExecuteNonQuery(Boolean async, CancellationToken cancellationToken)
   at ApacheAGE.AgeClient.ExecuteCypherAsync(String graph, String cypher, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at ApacheAGE.AgeClient.ExecuteCypherAsync(String graph, String cypher, CancellationToken cancellationToken)
   at ApacheAGE.AgeClient.ExecuteCypherAsync(String graph, String cypher, CancellationToken cancellationToken)
   at Program.<>c__DisplayClass0_0.<<<Main>$>b__2>d.MoveNext() in D:\labs\postgreGraphDemo\postgreGraphDemo.ApiService\Program.cs:line 56
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Http.RequestDelegateFactory.<ExecuteTaskOfTFast>g__ExecuteAwaited|132_0[T](Task`1 task, HttpContext httpContext, JsonTypeInfo`1 jsonTypeInfo)
   at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddlewareImpl.<Invoke>g__Awaited|10_0(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task)

That sounds like something is not working with waiting for the completion of a query.

paule96 commented 9 months ago

P.S.: The queries alone in a pg console are working fine

paule96 commented 9 months ago

Okay readed the source code.... The above described error is a false flag... The OpenConnection code already loads the pg extension and catalog.

paule96 commented 9 months ago

I will open a new issue for the real error