Querying HSTORE in postgres
See original GitHub issueI have a model that has an HSTORE column. I would like to use Sequelize’s find
method to perform queries searching for records based on data in the HSTORE column.
The raw query is:
SELECT row_data
FROM audit.logged_action AS logged_action
WHERE logged_action.action = 'I'
AND row_data ? 'id'
AND row_data->'id' = '16'
My (failed) attempt in Sequelize:
LoggedAction.findOne({
where: {
action: 'I',
row_data: {
id: billingDetail.id
}
}
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
PostgreSQL hstore Tutorial
You can query the rows whose hstore column contain multiple keys using ?& operator. For example, you can get books where attr column...
Read more >Documentation: 15: F.18. hstore - PostgreSQL
This module implements the hstore data type for storing sets of key/value pairs within a single PostgreSQL value. This can be useful in...
Read more >How to query values with wildcards in PostgreSQL hstore
You can extract values by key from an hstore column with the -> operator. SELECT data->'Supplier' AS sup FROM products WHERE ...
Read more >PostgreSQL hstore - Javatpoint
PostgreSQL hstore data type allows us to use the -> operator to select a particular key's data values from an hstore column (Movie_Attr)....
Read more >How hstore data Type works in PostgreSQL? - eduCBA
The PostgreSQL hstore column works dynamically, which means you do not need to specify the key prior to the table creation; you can...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@janmeier I am considering creating a PR for this. Would the following be correct?
Current Functionality
would produce
New functionality
would produce
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂