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
Add postgresql array #29
Comments
|
Could you provide a sample usage scenario (i.e actual code snippet)? |
|
I think I've changed my opinion here, and now posit that it's not DBIish's job to parse such values. The Postgres C client library returns them as strings, so DBIish should return them as string too. If you want something that maps them to a more advanced data types (arrays to arrays, hstore to hashes, jsonb to arrays/hashes/strings/numbers/...), that belongs into an ORM. If you disagree, please explain why it's DBIish's job. |
|
Well first DBI in perl5 does it. Array is a supported type defined in the SQL99 RFC. it's probably not only supported in Pg http://savage.net.au/SQL/sql-99.bnf.html#array specification |
|
Oh, I didn't know it was part of the SQL standard. If there's a way in which Postgres indicates that it's returning an array, I'm fine with it being implemented in DBIish after all. Still, (de)serialization in general belongs into layer about DBIish, because it requires more meta information about the data types being used/returned. |
|
Actually our mapping is not 100% correct as far as I can see, please take a look at pg_type.h. Namely this: #define INT2ARRAYOID 1005
#define INT4ARRAYOID 1007
#define TEXTARRAYOID 1009
#define OIDARRAYOID 1028
#define FLOAT4ARRAYOID 1021
#define CSTRINGARRAYOID 1263and PostgreSQL documentation on Arrays I am going to work on this one for the rest of the evening 👍 |
|
Initial implementation added in my forked repository. Please review https://github.com/azawawi/DBIish/commit/87d311f0e55052f067bba45ff53c4f938277dee3. |
|
Thanks for you work. |
|
@azawawi What is the status of the offered tests? |
|
Reworked a little the array engine and now pass the test provided by @Skarsnik |
|
@salortiz Thanks for the fix. I am very sorry but I was busy doing other projects and forgot about this issue 👍 |
Could be cool to have pg_array support, meaning fetch* should return an array for the array field and execute be able to work on array value.
Basicly it probably converting array string pg give us, they look like that: {NonSpace, "With Space"} and can be nested {{value, value}, {value, value}}
The text was updated successfully, but these errors were encountered: