Questions tagged [hstore]
hstore is data type for storing sets of key/value pairs in Postgres, similar to hashes in Ruby and Perl, associative arrays in PHP or dictionaries in Python.
451
questions
-1
votes
2answers
24 views
how can I get the last value for each key in a set of postgres hstore records?
I have a table of sensor readings as postgres hstore key-value pairs.
Each record has a timestamp at 1 sec intervals.
Not all sensors record every second.
The table is essentially:
create table ...
0
votes
0answers
65 views
How to remove a hstore pair with matching value in postgres
I see on the postgres documentation site that there is a function that allows you to delete pairs based on matching keys. I am wondering if there is a function / method to delete a pair based on a ...
0
votes
0answers
28 views
POSTGIS: insert geometry point in laravel 8x with factory
I created the following DB:
Schema::create('areas', function (Blueprint $table) {
$table->id();
$table->text('name');
$table->text('description');
$table->...
0
votes
0answers
43 views
How to Extract data from hstore json array in PostgreSQL
I have a database table which has a column having data stored in a format similar to store json array. To help make things clear, let's say the table is called browser having two columns -> id and ...
0
votes
1answer
23 views
How can I find out if a hstore is a subset of another hstore?
I have two hstore fields, that I want to compare, and I want to know if the one is a subset of the other?
So, let's say I have "foo"=>"bar","fnuggle"=>"snuggle&...
0
votes
0answers
25 views
How to use sub item on Vue-formulate schema?
I`m using django + vuejs for my saas. In my DB (postgres) i have hStore field. So i need to reference on name a sub field on my model, ie: store.name, store.address. Theres any possibility to do this ...
2
votes
1answer
51 views
Transforming HSTORE array values to a column in JSONB
I am trying to transform my data stored in HSTORE column ('data') of Postgres.
My row values have key "entity" and value is in the array.
"entity"=>"[{'id': .............}]
...
1
vote
1answer
43 views
Create check constraint on HSTORE to maintain specific succession of data
Question is regarding check constraint on HSTORE field in Postgres.
create table archives_seasonmodel
(episodes hstore)
This is very shortened version of table I have, but just for example ...
0
votes
1answer
78 views
How to insert in a Postgres table, a hstore value having one key and an array of values of as corresponding value?
So I have to create a table in Postgres to store the content of the table displayed on the image (events_logs). I figured out that I should use the hstore type for the PARAMS columns and everything is ...
2
votes
0answers
45 views
How can i convert plain PostgresSQL query into slick query?
Table: person
Mapped Tables
case class Person(id: Int, name: String, address: Option[Map[String, String]])
trait ReceiptRepositoryImpl {
self: PersonTable with SlickDBComponent =>
def ...
2
votes
1answer
73 views
Postgres COPY into hstore field with double quote in value
I have been trying for hours to populate a Postgres 12 database from a CSV file using the COPY command. The table in question has an hstore field and one of the key-value-pairs has a double quote &...
1
vote
0answers
67 views
Integrate hstore to timescaleDB for storing timeseries
Actually, I 'm conceiving my database for storing dynamic time series for sensors data. I chose Postgres DBMS and TimescaleDB to ingest data. I have different sensors types and each sensor has ...
2
votes
1answer
57 views
Postgresql: how to query hstore dynamically
I have the following tables
ORDER (idOrder int, idCustomer int) [PK: idOrder]
ORDERLINE (idOrder int, idProduct int) [PK: idOrder, idProduct]
PRODUCT (idProduct int, rating hstore) [PK: idProduct]
...
0
votes
0answers
34 views
How to return the string value with double quotes in hstore?
Create a sample table with a field with hstore data type:
CREATE TABLE books (
attr hstore
);
Insert values into table:
INSERT INTO books (attr)
VALUES
(
'"language" => "English",
...
0
votes
1answer
204 views
After compiling Postgresql 12 hstore extension was not found
I have compiled PostgreSQL 12 with the following code.
curl --progress-bar https://ftp.postgresql.org/pub/source/v12.2/postgresql-12.2.tar.bz2 | tar xj -C /usr/local/src/
cd src/postgresql-12.2
....
0
votes
1answer
212 views
Entity Framework Core PostgreSQL hstore queries
I need generate query for value in hstore column
var collection = await _context.Settings
.Select(b => new
{
SettingId = b.SettingId,
SettingParentId = b.SettingParentId,
SettingValue =...
0
votes
0answers
88 views
Unable to create table with postgres-hstore column type in H2 Database
I'm working on requirement to create a new table which has a column of type hstore. This is a Spring Boot app. I have created the JPA entity and run some tests connecting with the live posgres DB and
...
1
vote
0answers
35 views
Hstore error message with simple_form gem - Ruby on Rails
I have a nested form:
= simple_form_for(@item) do |f|
= f.input :name
-# Nested form
= f.simple_fields_for :content, OpenStruct.new(@item.content) do |builder|
- @item.category.fields....
0
votes
0answers
35 views
access values in a nested hstore with postgres
I have a data set with a file that looks like this
"post_engaged_users"=>"47",
"post_impressions_unique"=>"596",
"post_video_views_unique"=>"0",
"post_clicks_by_type_unique"=>"{\"other ...
0
votes
1answer
288 views
Using Sequelize/ORM with Postgres extension types like LTREE and HSTORE
I have an existing app that is using Node.JS & Express & Sequelize & PostgreSQL and now new requirements came up that require using PostgreSQL extension types like ltree to handle tree ...
0
votes
1answer
20 views
Insert columns value into hstore data type in postgres
I have a table in postgres which has this three columns id_0,turnr and tags. tags column data type is hstore.
currently i am using this query which is not working
INSERT INTO relation_15_02_2020 (...
0
votes
0answers
29 views
hstore sending hidden field as array
I have one old software built by developer where they are using hstore to store values. But web page load dynamically many different styles and make following form hidden values
<input type="...
0
votes
2answers
1k views
django.db.utils.ProgrammingError: can't adapt type 'dict' after I tried to add a Hstorefield to my model
I am developing an app in Django.
I tried to add a Hstorefield to my model, then I deleted it, and now I cannot anymore run the command manage.py makemigrations because I always get this error
(met5) ...
1
vote
1answer
250 views
Unexpected end of string when removing key from hstore
When I am removing a key from a HSTORE, I get the error 'Unexpected end of string':
DB=# UPDATE mytable SET properties = properties - 'key' where label = '9912345678';
ERROR: Unexpected end of ...
0
votes
1answer
466 views
Why ActiveRecord::Store.store_acessor doesn't reflect on the resulting SQL when querying
Consider this class:
class UsersMigration < ActiveRecord::Migration[5.2]
def change
create_table(:users) do |t|
t.hstore :settings
end
end
end
class User < ActiveRecord::...
0
votes
0answers
28 views
Why Minitest (Rails 4.2) failed when I add a key/value column (Hstore) in a fixture definition?
I'm using rails 4.2, minitest 5.11.3, and minitest-rails 2.2.1
My test class has some problem when I want to exploit hstore field from postgresql into fixture.
Here my test class WelcomeMailerTest ...
0
votes
1answer
602 views
Benefits of hstore over a key/value table with PostgreSQL?
In one of our applications, we need to have some key/value pairs that we will periodically update.
We initially thought about a table which would be something like:
CREATE TABLE "KeyValue" (
"...
1
vote
2answers
130 views
How do I pick out one hstore column from a group in Postgres?
Suppose I have a table foo in Postgres 11.5:
CREATE TABLE foo (an_int integer, a_varchar varchar(50));
I can select columns unique by integer and grab a couple of the a_varchar values as samples as ...
0
votes
1answer
51 views
Implementing PostgreSQL HStore in Django
I found some couple of packages to implement PostgreSQL HStore in Django from djangopackages.org. The most stared and most forked package was last updated in March 2, 2017 [DJANGO-HSTORE]. I think it ...
1
vote
1answer
125 views
How to perform a pattern matching query on the keys of a hstore/jsonb column?
I'm trying to perform a pattern matching on an hstore column on a Postgresql database table.
Here's what I tried:
SELECT
*
FROM
products
WHERE
'iphone8' LIKE ANY(AVALS(available_devices))
...
1
vote
2answers
200 views
Update hstore values with other hstore values
I have a summary table that is updated with new data on a regulary basis. One of the columns is of type hstore. When I update with new data I want to add the value of a key to the existing value of ...
0
votes
1answer
243 views
Enable PSQL hstore extension in Django test db during CI
Context
Some steps of my Continuos Integration procedure are:
start Postgres docker container
run Django tests
When manage.py test --noinput command is runned it:
creates a new test_xxx database (...
0
votes
1answer
150 views
How to resolve a Django hstore error in tests
At some points in the app I'm collaborating on, a HStoreField is used (from django.contrib.postgres.fields). The app itself works normally, no build errors. But when I run tests, I get an issue:
...
1
vote
1answer
77 views
Rails: Hstore column: search for the same value in all keys in fastest way
I have a table (over 100,000 records) with hstore column that has 12 keys. I want to search the hstore column for a value that can be in any of the 12 keys. What is the fastest way of doing this?
My ...
1
vote
0answers
75 views
How can use the hstore extension type when migrating OSM data to PostGreSQL?
I am trying to migrate some Open Street Maps .osm.pbf file to my postgresql database using osm2pgsql on an ubuntu machine.
When I inspect the data after the process has been finished, the column for ...
0
votes
2answers
91 views
Rails3: Postgres Hstore: How to insert multiple records in a table that has an hstore column
I want to insert multiple records in my table that has an Hstore column.
How can I do that?
col3: hstore datatype
INSERT INTO my_table (col1, col2, col3) VALUES ("abc",123,'"property1"=>"hello","...
0
votes
1answer
33 views
Construct JSONB from separate arrays of keys and values
PostgreSQL has a very useful hstore(text[], text[]) function which will "construct an hstore from separate key and value arrays". I am looking for a JSONB equivalent, but there isn't one that I can ...
0
votes
1answer
75 views
Maintain uniqueness on django-localized-fields
I'm trying to avoid having duplicate localized items stored in a Django-rest-framework app, django-localalized-fields package with a PostgreSQL database I can't find any way to make this work.
(...
1
vote
1answer
104 views
Hstore Query to find records matching with any array element using ruby on rails
I've a hstore field in a database table. I want to write a Query to find records matching with any array element in any hash of hstore field using ruby on rails.
Users Table
------------------------...
4
votes
1answer
643 views
Can not install hstore extension to new created schema
I have an ubuntu 18.04 with postgres 9.5 installed.
My db "mydb" has the hstore installed. When I do "\dx store", I do have
List of installed extensions
Name | Version | Schema | ...
2
votes
2answers
387 views
How to handle empty values produced by NLog's all-event-properties layout renderer?
I'm configuring NLog's database target for PostgreSQL and I want to use hstore column to store all event properties. I'm using all-event-properties layout renderer for that.
Here's my current target ...
2
votes
1answer
254 views
parsing hstore in python3 using sqlalchemy
I have a csv file where one of the columns is written in hstore format. I would like to convert it into python dict but at the same time keep my code DRY. My codebase uses sqlalchemy, which has a ...
2
votes
1answer
413 views
How to serialize a Hstore field in drf
I have an HStoreField in my model. Example:
attributes = HStoreField(default=dict, blank=True)
My view and serializer:
class CarSerializer(serializers.ModelSerializer):
class Meta:
...
0
votes
1answer
251 views
how to write hstore column in where clause of spring data jpa query
I am facing a problem in writing the "hstore" type column in where clause of spring data jpa query.
@Transactional(readOnly = true)
@Query(
value = "select ld from LocationData ld inner join fetch ...
2
votes
1answer
1k views
How to insert a hstore object using lib/pq to postgres
For this table,
# \d table
Table "public.table"
Column | Type | Collation | Nullable | Default
------------+-----------------------------+--...
0
votes
1answer
172 views
In Ransack update ranackers dynamically when a model gets updated
I have Company Customer and CompanyCustomerField models. Customers store the hstore values in a column "properties" - the keys are from the CompanyCustomerField#name field. When a new ...
3
votes
1answer
33 views
Column mistakenly returning the key from HSTORE
Ok, I have a weird one here.
In a Rails 4.0.13 application, I've added to a model:
store_accessor :transcoding_meta, :state
Looking at the schema of the model (SongVersion), transcoding_meta's type ...
1
vote
0answers
33 views
Failing hstore tests Django
I am having a problem when I get the value from a hstore field. The situation is something like this:
model:
class Model(models.Model):
hstoreField = HStoreField()
test cases:
def test_case_1(...
0
votes
1answer
49 views
postgresql - select from nested hstore and then delete
My code below works but is there a better approach to this? What would the syntax for the delete be?
Thanks in advance, my mainframe background is showing.
v_result boolean;
...
0
votes
2answers
270 views
I am getting a syntax error on a hstore variable at insert
CREATE EXTENSION hstore;
CREATE TABLE skm_employee_skillset
(
employee_id integer PRIMARY KEY,
created_date DATE DEFAULT current_date,
last_update ...