bitnine-oss / agensgraph

AgensGraph, a transactional graph database based on PostgreSQL
http://www.agensgraph.org
Other
1.33k stars 148 forks source link

feature or bug? -- head() and last() convert edge to json #525

Closed pebbe closed 2 years ago

pebbe commented 3 years ago

The AgensGraph Developer Manual for head() says: Returns the first element in the list.

It doesn't mention that the element may be converted to another type.

Below is an example with head(). With last() you get similar results.

Is this a feature or a bug? If it's a feature, then perhaps the documentation should mention this?

peter=# match (:node)-[r:rel*2]->(:node)
return r[0]
limit 1;
                        r                         
--------------------------------------------------
 rel[11.2][5.1,5.2]{"rel": "--", "primary": true}
(1 row)

peter=# match (:node)-[r:rel*2]->(:node)
return head(r) 
limit 1;
                                                    head                                                    
------------------------------------------------------------------------------------------------------------
 {"id": "11.2", "end": "5.2", "tid": "(0,2)", "start": "5.1", "properties": {"rel": "--", "primary": true}}
(1 row)
jrgemignani commented 3 years ago

Hi Peter,

I'm not sure what the reason is for having the array operation have a different result type from the head operation.

I will bring this to the attention of those responsible.

Thanks!

John

On Wed, Nov 18, 2020 at 10:48 AM Peter Kleiweg notifications@github.com wrote:

The AgensGraph Developer Manual for head() says: Returns the first element in the list.

It doesn't mention that the element may be converted to another type.

Below is an example with head(). With last() you get similar results.

Is this a feature or a bug? If it's a feature, then perhaps the documentation should mention this?

peter=# match (:node)-[r:rel*2]->(:node) return r[0] limit 1; r

rel[11.2][5.1,5.2]{"rel": "--", "primary": true} (1 row)

peter=# match (:node)-[r:rel*2]->(:node) return head(r) limit 1; head

{"id": "11.2", "end": "5.2", "tid": "(0,2)", "start": "5.1", "properties": {"rel": "--", "primary": true}} (1 row)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bitnine-oss/agensgraph/issues/525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALPO4AYC6M5KX4TLNFYNQTSQQJGBANCNFSM4T2LMQSA .