Data dodania Pytanie
2016-12-30 08:12 Getting the list of Objects and the corresponding value in Postgres (JSON data) »
I have the following JSON data which has an array of Objects PRODUCTION -> KBM -> (array of Objects) What I am looking for is to get all the values f...
(1) odpowiedzi
2016-12-29 12:12 SQL select every xth row based on total number »
I have a table with gps data: lat, lon, timestamp My queries select by a timestamp window: SELECT * FROM gps WHERE timesamp >= '2016-12-12T02:0...
(2) odpowiedzi
2016-12-29 10:12 How can I traverse a tree bottom-up to calculate a (weighted) average of node values in PostgreSQL? »
The typical example for e.g. summing a whole tree in PostgreSQL is using WITH RECURSIVE (Common Table Expressions). However, these examples typically ...
(1) odpowiedzi
2016-12-29 08:12 In postgresql how to change the value in jsonb type cloumn? »
Now I want to use postgresql function to change the jsonb type cloumn's value,now I have a function achieve the type json CREATE OR REPLACE FUNCTION...
(1) odpowiedzi
2016-12-29 05:12 Select random from SQL table which evenly distributes across a column's different values »
I have a table USERS which holds demographic information. For brevity, lets say one of the columns AGE can have one of five values (16, 17, 18, 19, 20...
(2) odpowiedzi
2016-12-28 19:12 Using variables in a PL/pgSQL function »
Postgres PL/pgSQL docs say: For any SQL command that does not return rows, for example INSERT without a RETURNING clause, you can execute the co...
(2) odpowiedzi
2016-12-28 16:12 SQL Server's SET NOCOUNT ON Postgresql equivalent »
I've to help migrating a SQL Server 2008 database to a PostgreSQL 9.4.10 one. The original querys have SET NOCOUNT ON and SET NOCOUNT OFF several time...
(0) odpowiedzi
2016-12-28 16:12 Create criteria statement, get the result and the row count with one query »
I'm trying to fetch results and also the row count inside a single query for pagination. This is what I got so far: public List<User> getUser...
(0) odpowiedzi
2016-12-28 13:12 Rails: How to show items only if creator is unique? »
I have many users and each user has multiple projects. Now, I want to get only one item per user. @projects = Project.all.where(user_id is unique) ...
(2) odpowiedzi
2016-12-28 05:12 New to ruby, hard time understanding combined ruby/sql syntax (that is also hard to google) »
I would appreciate some pointers to how to interpret some probably trivial syntax in an sql statement within a ruby method Basically, the function is...
(2) odpowiedzi
2016-12-28 02:12 How to loop through jsonb array of objects to get values of keys within objects Postgres »
I am using Postges 9.4 and I have a table that has a jsonb field as an array of objects. Here is a sample field: [{"pk": 224, "arbitrary_value": 50,...
(1) odpowiedzi
2016-12-27 17:12 query that shows if the tables might need analyze and vacuum »
i have this doubt I loking for a query that returns if my tables from given schema need analyze and vacuum before wraparound wich can not happen, so ...
(0) odpowiedzi
2016-12-27 14:12 PostgreSQL - Best way to check the existance of reverse valued rows »
I know I failed to find a proper title. For the sake of argument i have this table: sender|receiver a | b c | d d | e b | a...
(2) odpowiedzi
2016-12-27 14:12 how to write a postgresql query to fetch field value inside array of json data »
The following data is a sample json data in postgres db { "RA1":{ "RaItems": [ { "a": 1, ...
(1) odpowiedzi
2016-12-27 10:12 How to add a column to typed table without altering type in PostgreSQL? »
I am using PostgreSQL 9.5, I have a TYPE which discribes a collection of columns: CREATE TYPE datastore.record AS (recordid bigint, ... ta...
(2) odpowiedzi
2016-12-26 15:12 How to ignore some rows while importing from a tab separated text file in PostgreSQL? »
I have a 30 GB tab separated text file which has more than 100 million rows, when I want to import this text file to a PostgreSQL table using \copy co...
(4) odpowiedzi
2016-12-26 11:12 How to recognise text file from my linux pc via django code without checking its extension and also its file size? »
Most of the time when we create a new text file with gedit in linux then the file is not saved with an extension of .txt for text file.So how will I r...
(2) odpowiedzi
2016-12-26 08:12 HSTMT, UCHAR, SDWORD meaning in ODBC Log »
I have the following lines in my ODBC Log : (Scenario: pgAdmin4, using PostgreSQL server through ODBC32 in another application named System Administr...
(2) odpowiedzi
2016-12-25 17:12 ALL query in Ecto »
I need to translate the following SQL to Ecto Query DSL. SELECT otc.* FROM users u INNER JOIN one_time_codes otc ON u.id = otc.user_id LEFT OUTER JOI...
(1) odpowiedzi
2016-12-25 15:12 Slick 3.1.1 sql PSQLException: ERROR: syntax error at or near "" + "" »
I have the following simple (and tested in Postgres) query that leads to the above error and I can't find what it is. def findActiveByProviderKeyAndE...
(1) odpowiedzi
2016-12-25 00:12 Does Postgres have a way to filter by count of a entry's related table? »
Okay admittedly that title wasn't the best, but I don't know how else to ask this... I'm using the Sequel gem with Postgres. I have a database with P...
(1) odpowiedzi
2016-12-24 12:12 How to import YYYY/MM and YYYY/MM/DD to a same column in PostgreSQL? »
I want to import some data from a text file to a PostgreSQL table. when I create the table I have a column with a data type of DATE. when I want to im...
(2) odpowiedzi
2016-12-24 11:12 Scalable way to search for (similar) strings in a database »
Let me describe my problem. There is an input string, and a table containing many thousands of strings. I am looking for best way to search for the mo...
(1) odpowiedzi
2016-12-24 08:12 How to organize appition with PostgreSQL and php? »
I watched Yii2 and Laravel but I do not want use ActiveRecord, ORM and QueryBuilder for my application but if I do not use them that 50% functionality...
(2) odpowiedzi
2016-12-23 14:12 How to convert oracle hierarchical queries to postgresql? »
I want to convert below mentioned oracle hierarchical query to postgresql SELECT catalog_id, sub_tree_id FROM my_catalog CONNECT BY PRIOR catalog_i...
(2) odpowiedzi
2016-12-23 13:12 Migration in rails 5 with jruby »
I create a database via rake task successfully. But I have a problem while migrating my migration files for models. I always get the following problem...
(0) odpowiedzi
2016-12-23 13:12 Should I reverse order a queryset before slicing the first N records, or count it to slice the last N records? »
Let's say I want to get the last 50 records of a query that returns around 10k records, in a table with 1M records. I could do (at the computational c...
(1) odpowiedzi
2016-12-23 12:12 Is querying a set number of columns faster for a small table than a large table? »
I am designing a database that will include a high score list and need the SQL queries to be fast for the list. There will be a 1-to-1 relationship b...
(3) odpowiedzi
2016-12-23 01:12 PostgreSQL jsonb_set not working »
update table set json = jsonb_set(json, '{field}', array_to_json(array_append(array(select * from jsonb_array_elements_text(json->'array')), '1')),...
(1) odpowiedzi
2016-12-22 23:12 How to retrieve messages from a given date using Jsonb? »
I have the following table: CREATE TABLE tbl (tbl_id int, messages jsonb); CREATE INDEX index_tbl ON tbl USING gin (messages); And the JSON message...
(1) odpowiedzi
2016-12-22 16:12 Generate serie with prefix and leading zeros (postgresql) »
I am trying to generate a serie that contains both prefix ('A') and leading zeros. SELECT * FROM generate_series(8,12) will generate a serie 8 9 1...
(2) odpowiedzi
2016-12-22 14:12 What is the best alternative for the following situation? »
I'm using a JSONB field in my Postgresql database to store the following document. I own thousands of documents. I need to create reports with this da...
(2) odpowiedzi
2016-12-22 09:12 How good is BDR for production Postgres sync? »
I have a system where multiple satellites create financial transactions and they need to sync up with a core server. The satellites are remote servers...
(1) odpowiedzi
2016-12-22 00:12 Can JOIN operations be ordered in a CTE? (PostgreSQL) »
PostgreSQL 9.5 The below CTE works correctly to move records from tables CPT and CPT_INVOICE to DOCTOR_PROCEDURES and update DOCTORBILLING uid accord...
(2) odpowiedzi
2016-12-21 17:12 Correct way to add points and calculate distances in miles using postGIS »
I'm brand new to PostGIS and want to create a column in my database for a new place that stores its latitude and longitude (a 2D point). Later I will ...
(2) odpowiedzi