Data dodania Pytanie
2017-12-03 21:12 CTE Execution Order »
In the following CTE statement: CREATE TABLE test_table (Field1 INTEGER, Field2 INTEGER); CREATE TABLE test_table2 (Field1 INTEGER, Field2 INTEGER); ...
(1) odpowiedzi
2017-12-03 03:12 2 Functional Dependencies in a single table »
I'm trying to create a schema based on these 2 Functional Dependencies. A -> B, C, D B -> D I'm trying to create a single tabl...
(1) odpowiedzi
2017-12-02 19:12 Postgresql - Split data from a column into two columns »
I have a small Porstgre database where I a have a table with several columns. One of those columns contains data like this : test1 (80%) test2 (21%) t...
(2) odpowiedzi
2017-12-02 07:12 SQL: how to select the time range of an employee and group by timeframe interval 30mins »
I have three columns, time-in(timestamp), time-out(timestamp) and employee. I need to get the number of employees that work in a specific timeframe (3...
(4) odpowiedzi
2017-12-02 02:12 Insert conditionally on number of rows matching condition in Postgres »
I have a table like this: create table if not exists features ( username text not null, feature text not null, attributes text[] not...
(1) odpowiedzi
2017-12-01 17:12 No operator matches the given name and argument type in pg backed rails app »
First I implemented a sample search functionality a rails app using SQLITE as the database. And the query was as follows: @productions = Production....
(1) odpowiedzi
2017-12-01 14:12 Filtering by categories with rails »
I have 2 models Recipe and Category, they associated with has_and_belongs_to_many, now I need to filter recipes by categories, when user checks catego...
(1) odpowiedzi
2017-12-01 10:12 What does this "t" do? »
I'm having trouble understanding the following example from the PostgreSQL documentation: -- set returning function WITH ORDINALITY SELECT * FROM pg_...
(2) odpowiedzi
2017-12-01 10:12 Django Postgresql JsonField query related dictionary keys »
A part of the model that I have, which uses Django Model field, is like the following: class SalesModel(models.Model): some_data = models.Positiv...
(3) odpowiedzi
2017-12-01 08:12 ActiveRecord AVG calculation »
I have request: Model.group(:p_id).pluck("AVG(desired)") => [0.77666666666666667e1, 0.431666666666666667e2, ...] but when I ran SQL SELECT AVG...
(2) odpowiedzi
2017-12-01 06:12 Is it possible to combine Group by, Having and Sum? »
I have a table: ------------------------ |id|p_id|desired|earned| ------------------------ |1 | 1 | 5 | 7 | |2 | 1 | 15 | 0 | |3 | 1 ...
(5) odpowiedzi
2017-11-30 20:11 Find all IDs which have a row with value A AND a row with value B »
I have a table like this: +-----+-------+-----+ | id | value | ... | +-----+-------+-----+ | 1 | A | ... | | 1 | B | ... | | 1 | C ...
(2) odpowiedzi
2017-11-30 20:11 Postgresql 10.1 - two similar queries, 200 times difference »
Two queries. First is 200 times longest than second. Why? PostgreSql 10.1. Metro and Sel - views on the same table. EXPLAIN ANALYZE SELECT * FROM ( ...
(3) odpowiedzi
2017-11-30 09:11 POSTGRES: UPDATE multiple rows WHERE columnName has int in given range »
I want to execute a query Which has table as mentioned below : Order_no. Order_string Order_Int Order_status ABE001 ABE 1 ...
(1) odpowiedzi
2017-11-29 21:11 postgres JSONB: check if all keys *contained by* an array »
the postgres doc says that i can use ?& to check if a JSONB object's keys contains all elements in an array. is there something for me to check if...
(1) odpowiedzi
2017-11-29 16:11 Rails 5 Migration Data Type Issue »
I originally developed my rails 5 application using PostgreSQL. I had to change over to a MariaDB after I had done all of my development due to some i...
(1) odpowiedzi
2017-11-29 14:11 How to fill in the gap between a range of numbers? »
I have a database with number ranges entered using hyphens for example 1-10, 50-100, 34-38. How would I fill in the blanks where the hyphen is and cr...
(1) odpowiedzi
2017-11-29 12:11 How to make a regular expression in postgres lazy »
I have this sql expression: regexp_matches(view_definition,'(ms_sub_[0-9]+)(.*group by)','ig') which is trying to return the text between 'ms_sub_'...
(1) odpowiedzi
2017-11-29 04:11 Passing date parameters to a sql select query in rails (QueryMethods) »
I am working with the brakeman gem (which identifies possible security issues in Ruby on Rails code). We have a scope which uses joins, group and sele...
(2) odpowiedzi
2017-11-28 20:11 Creating GIN index on ILIKE postgres query »
I am using postgres 9.6. I store JSONB data in one column and I would improve performance of one query. In my json data I have name column which is te...
(1) odpowiedzi
2017-11-28 17:11 INSERT SELECT FROM VALUES casting »
It's often desirable to INSERT from a SELECT expression (e.g. to qualify with a WHERE clause), but this can get postgresql confused about the column t...
(2) odpowiedzi
2017-11-28 15:11 How do I create a new row with all default values in Postgres? »
I have a table with two columns, id and created. Both have default values, so I should be able to insert a new row without supplying any data. Howev...
(2) odpowiedzi
2017-11-28 11:11 Regex for PostgreSQL for getting domain with sub-domain from URL/Website »
Basically, I need to get those rows which contain domain and subdomain name from a URL or the whole website name excluding www. My DB table looks lik...
(2) odpowiedzi
2017-11-27 20:11 postgres trigram index is too slow with ilike search »
I'm doing a pattern matching search with ILIKE in our system, but it gets too slow with some tables due to the amount of records in the table. So I'm ...
(1) odpowiedzi
2017-11-27 17:11 Represent date/time periods »
I'm working on a booking platform which has several different rates. These rates are determined by the time of day, day of week, and day of year. Here...
(1) odpowiedzi
2017-11-27 15:11 ld: framework not found libpq »
Im making a iOS app and have to connect to a PostgreSQL database without web service (connect directly with the database). I started my journey from h...
(1) odpowiedzi
2017-11-27 06:11 jsonb_set pass variable value instead of static in procedure »
Need help to get jsob_set working under PostgreSQL procedure, Fetching records from child table and updating parent table's json fields value. Assign...
(0) odpowiedzi
2017-11-26 11:11 Escaping hyphens in tsquery (postgresql) »
I need to create a tsquery based on the string of the following format: something-smth-somthing-etc-etc Calling to_tsquery('something-smth-somthing...
(1) odpowiedzi
2017-11-26 11:11 Painfully slow Postgres query using WHERE on many adjacent rows »
I have the following psql table. It has roughly 2 billion rows in total. id word lemma pos textid source 1 Stuffing ...
(3) odpowiedzi
2017-11-26 02:11 Postgres - How to automatically call ST_SetSRID(ST_MakePoint(lng, lat), 4326) on inserts? »
I'm using postGIS, and I'm not very familiar with SQL. I can successfully insert into my markers table as long as I do something like this (pseudocod...
(2) odpowiedzi
2017-11-25 21:11 Insert records in batch Slick »
I want to insert more than 10 rows of data into the Task table, so I have created a list of these records. Except for my table, I have a repository wi...
(1) odpowiedzi
2017-11-25 21:11 Matching rows of two tables by their attributes »
Is there a way to match entities in plain PL/pgSQL? Let's say I want to search a single person in a customer table by using a text search query that c...
(1) odpowiedzi
2017-11-25 11:11 No ROLLUP and CUBE in PostgreSQL 9.4? »
I have some queries containing rollup and cube statements. When I run them on a computer with PostgreSQL 9.4 and PgAdmin III, it says that such functi...
(1) odpowiedzi
2017-11-25 03:11 How to add index on extract() in postgresql »
I'm using a query with following WHERE condition in postgres database: WHERE extract(EPOCH FROM created_at) BETWEEN 1511132400 AND 1511737199 How ca...
(1) odpowiedzi
2017-11-24 22:11 Golang Postgresql Array »
If I have a table that returns something like: id: 1 names: {Jim, Bob, Sam} names is a varchar array. How do I scan that back into a []string in ...
(1) odpowiedzi