Data dodania Pytanie
2017-04-22 11:04 pass a query to row_to_json function inside a store procedure in postgres »
I am trying to write a store procedure where I pass a query into a stored procedure which will internally call the row_to_json function. We have multi...
(1) odpowiedzi
2017-04-22 04:04 macOS Server 5.3 Calendar pg_ctl not starting »
After updating macOS Server to 5.3 (running on macOS 10.12.4) my Calendar & Contacts have stopped syncing. It seems that it's having trouble star...
(0) odpowiedzi
2017-04-22 02:04 PostgresSQL: table referencing only part of a composite primary key »
I am Creating a movie and tv show streaming service database(for school project) using Postgres 9.6.2. I am running into the following error: there ...
(1) odpowiedzi
2017-04-21 21:04 Can't decrypt using pgcrypto from AES-256-CBC but AES-128-CBC is OK »
I have problem decrypting data in pgcrypto that was previously encrypted in PHP app. I tried 3 types of encryption: 1) mcrypt - RIJNDAEL 128 CBC 2) m...
(1) odpowiedzi
2017-04-21 19:04 multi column indexes involving nulls »
I have a where clause WHERE (v.regstnum = voters.regstnum OR voters.regstnum IS NULL) AND (v.regstfrac = voters.regstfrac OR voters.regstfrac IS NU...
(0) odpowiedzi
2017-04-21 16:04 Postgresql transpose rows to columns »
I have this query select * from sales shop | date | hour | row_no | amount -----------+------------+-----------+--------+--------...
(1) odpowiedzi
2017-04-21 14:04 Detect specific string including wildcards and isolate wildcards in PLPGSQL »
Is it possible in PostgreSQL 9.4 (PLPGSQL) to detect if a string contains a certain string including wildcards and get the wildcards, ex.: IF NEW.my_...
(1) odpowiedzi
2017-04-20 22:04 GROUPing extracting first and last row »
I have the following "starting" query: select fecha as date,velocidad as speed, velocidad>100 as overspeed from reports.avl_historico_35489804663...
(3) odpowiedzi
2017-04-20 18:04 Knex with Postgres storing timestamp in unintended ways »
I am using Knex query builder with Postgres in my application. I am trying to add a created_at and updated_at fields in my database with ISO8016 forma...
(1) odpowiedzi
2017-04-20 17:04 array_agg with distinct works in postgres 9.4 but not in postgres 9.6 »
I have a query that use array_agg with distinct as an argument and is not accepted on postgres 9.6. I created this sample to illustrate the issue: c...
(2) odpowiedzi
2017-04-20 16:04 PostgreSQL vacuuming a big table »
I have Postgres 9.4.7 and I have a big table ~100M rows and 20 columns. The table queries are 1.5k selects, 150 inserts and 300 updates per minute, no...
(1) odpowiedzi
2017-04-20 13:04 Cumulative (running) sum with django orm and postgresql »
Is it possible to calculate the cumulative (running) sum using django's orm? Consider the following model: class AModel(models.Model): a_number =...
(3) odpowiedzi
2017-04-20 12:04 jsonb_agg: Avoid objects wrapped with "jsonb_build_object" »
I can create JSON objects using jsonb_build_object the way I want them. E.g. SELECT jsonb_build_object('id', id) FROM (SELECT generate_series(1,3) id...
(1) odpowiedzi
2017-04-20 11:04 Update every value in an array in postgres json »
In my postgres database I have json that looks similar to this: { "myArray": [ { "myValue": 1 }, { ...
(1) odpowiedzi
2017-04-19 22:04 Tsrange - Subtracting the differences between two tables based on an id field »
I have two tables. free_time and appointment. I would like to subtract all of the appointment records from the records of free time. The result would ...
(1) odpowiedzi
2017-04-19 19:04 Using PostgreSQL, how do I escape "\" in json columns? »
I'm using Postgres 9.5 and I have a column ("info") of type 'json'... I'm trying to do this insert: INSERT INTO table ( info ) VALUES ( '{"entry":"...
(1) odpowiedzi
2017-04-19 16:04 Select only the rows with the latest date in postgres »
I have data in a table set up as follows with date stored as date type. I only wanted the latest date for each row (house) the number of entries per h...
(3) odpowiedzi
2017-04-19 12:04 How to improve query performance that compute haversine formula? »
Given a table of locations with latitudes and longitudes, which of those locations are nearest to a given location? Of course, finding distances on t...
(0) odpowiedzi
2017-04-19 10:04 query and subquery join in laravel »
i m trying this on laravel but i m getting error like this SQLSTATE[42601]: Syntax error: 7 ERROR: subquery in FROM must have an alias LINE 3: (se...
(2) odpowiedzi
2017-04-19 09:04 How to fetch data based on multiple key pair in Postgresql + Rails4 »
I have a table XYZ which has few columns in which, I need to filter out resultset based on Two columns (col1, col2) requested params Request params l...
(1) odpowiedzi
2017-04-19 01:04 When does a NOT NULL constraint run and can it wait until the transaction is going to commit? »
I have a table being populated during an ETL routine a column at a time. The mandatory columns (which are foreign keys) are set first and at once, so ...
(1) odpowiedzi
2017-04-18 19:04 Django user registration and authentication to mutiple databases »
I'm looking for a way to register and authenticate custom users accross mutiple databases using Django and postgreSQL. The application will be cross ...
(1) odpowiedzi
2017-04-18 17:04 PostgreSQL gist index »
I have a table with two date like dateTo and dateFrom, i would like use daterange approach in queries and a gist index, but it seem doesn't work. The ...
(1) odpowiedzi
2017-04-18 14:04 In postgres, what is the best way to do an AND with a join table? »
I have different categories of user, and a join table that allows users to be in more than one category. My join table is called categories_users and...
(3) odpowiedzi
2017-04-18 14:04 How to import BLOB formatted as CSV to postgres »
I have a csv file that is an output from a BLOB store. The csv contains 6 related tables. Not all records utilise the 6 tables but all records do use ...
(1) odpowiedzi
2017-04-18 12:04 persist random items with no duplicates in constant time »
I've a an array in which I take out random items [a, b, c, d ,...] function getRandomItem(){ // return random item from array } I also have a S...
(1) odpowiedzi
2017-04-18 12:04 Rails, nested has_many association, finding sum of field of last children of each »
I have nested models like (using PostgresSQL) class User has_many :pages end class Page has_many :details belongs_to :user end class Detail ...
(1) odpowiedzi
2017-04-18 10:04 Postgres migrate uuid column type with default value doesn't work »
My migration is class AddUuidToUsers < ActiveRecord::Migration def change add_column :users, :uuid, :uuid, null: false, default: 'uuid_gener...
(1) odpowiedzi
2017-04-18 08:04 SQL count second column for-each unique row of first column »
I have this sample many-to-many table for students & subjects in a university student | subject ----------------- James | English James | Phy...
(5) odpowiedzi
2017-04-17 21:04 How to implement per-user views of database? »
I have a postgresql table that contains widgets and their various attributes. Each widget belongs to a group of users, but each user in the group may ...
(1) odpowiedzi
2017-04-17 21:04 How to save and return JavaScript Object with Subarray in Normalized SQL »
I am using postgres-node, but I think this is a problem for anyone with javascript objects that have subarrays they want to save in SQL. I have a java...
(2) odpowiedzi
2017-04-17 20:04 Django implementation of default value in database »
I had a field on a model with was: class SomeModel(models.Model): some_field = models.CharField(max_length=10, null=True, blank=True) Then I ch...
(1) odpowiedzi
2017-04-17 08:04 Insert, update or alter column in postgres when working with to_char »
What i have; 3 tables in postgres 9.4. Table 1 is the main table tables 2 and 3 contain some additional data (an update multiplier) which is quarterl...
(1) odpowiedzi
2017-04-16 21:04 Is it okay to validate JSON at PostgreSQL side? »
Writing APIs I used to validate all input parameters on the Java (or PHP, whatever) side, but now we moved our DBs to PostgreSQL which gives us great ...
(1) odpowiedzi
2017-04-16 16:04 Unable to run rake db:migrate or any other db related actions »
Good afternoon, We are trying to upgrade our application to Rails 5. The first step is to migrate from Rails 3.2 to Rails 4 (yes we are a bit behind)...
(1) odpowiedzi