Data dodania Pytanie
2017-01-11 22:01 Add a total at the bottom »
I need to add a Total at the bottom of my table. Is this possible in my scenario? select country, count(*) from customer group by country Country ...
(4) odpowiedzi
2017-01-11 16:01 Can't use to_date() on aliased column »
I'm trying to sort by group and sort by month. Since I am using to_char(date_field, 'Month') as month to get the month as a string instead of a date....
(1) odpowiedzi
2017-01-11 12:01 SQL cloning and converting a date column »
(postgreSQL database) I have a date column that appears to be in the format of 'yyyy-mm-dd' firstly I'd like to convert that said column to 'yyyymm'....
(2) odpowiedzi
2017-01-11 10:01 How to sort combination of integer and text in PostgreSQL? »
I have this table id value 1 OK 2 xminimum 3 NO 4 YES I want to sort this table by value where minimum is always first then the rest acco...
(3) odpowiedzi
2017-01-11 04:01 Postgresql - distinct values from jsonb array »
I have the following jsonb array column (tags) |name | tags (jsonb) | -------------------------------- |john | [ "foo", "bar" ] |smith| [ "bar", "b...
(1) odpowiedzi
2017-01-10 22:01 Insert geometry LINE value using PostgreSQL 9.5 »
I want to insert line value into table. I already inserted point by using the folowing command: INSERT INTO public."Sample"(point) VALUES ( point...
(1) odpowiedzi
2017-01-10 22:01 Insert within function fails with "query has no destination for result data" »
Here is the complete example code: CREATE TABLE testtbl ( id integer NOT NULL, intval integer, strval varchar(64) ); CREATE SEQUENCE test...
(1) odpowiedzi
2017-01-10 20:01 Generate 2d array with given values »
I'm trying to turn a 1d jsonb array [1, 2] into 2d array where its elements are repeated 3 times (the result can be in jsonb) [[1, 1, 1], [2, 2,...
(1) odpowiedzi
2017-01-10 19:01 PostgreSQL - is jsonb_set() performance O(1)? »
I am building a social network, and trying to implement a data structure for saving time line event ids for each user. I was inspired by Redis Twitter...
(1) odpowiedzi
2017-01-10 15:01 Laravel Docker cannot execute PostgreSQL pg_restore »
I'm running a docker container with Laravel 5 and I have PostgreSQL on my machine. Everything works perfectly, except that I have waaaay to many dat...
(3) odpowiedzi
2017-01-10 08:01 How to store data from html form to postgres database using Django 1.10? »
I am new to Django , i just created a simple form to store the user input to database, but the data is not stored while clicking submit button, when i...
(2) odpowiedzi
2017-01-09 12:01 How to get data from 2 tables based on search keyword rails »
I have 2 tables schools and private_schools and they are not related to each other. What I need to do is to search the data from both tables to popula...
(3) odpowiedzi
2017-01-09 11:01 How to refer OLD record in trigger when statement is INSERT ON CONFLICT DO UPDATE? »
I am writing a trigger like this, CREATE OR REPLACE FUNCTION insert_check() RETURNS TRIGGER AS $$ BEGIN IF NEW.id = '' OR NEW.name = '' THEN ...
(0) odpowiedzi
2017-01-09 08:01 Turning arbitrarily many rows into columns in PostgreSQL »
I have a table in Postgres that was designed to capture information in unstructured form and rebuild it. I need to re-apply some structure when export...
(2) odpowiedzi
2017-01-09 01:01 How to list records of a Table with a counter of how many are used through a relationship »
I have these 2 tables: create_table "instruments", force: :cascade do |t| t.string "name" ... create_table "user_instruments", force: :c...
(1) odpowiedzi
2017-01-09 00:01 Knex create POINT data type in Postgres »
I'm trying to create a schema with a POINT datatype & knex just doesn't seem to be creating it in the DB. However it's creating all the other fiel...
(1) odpowiedzi
2017-01-08 21:01 Restricted PostgreSQL permissions for web app »
Goal Create a database with three users and restrict their privileges (I'm just thinking out loud, so my user separation is also open to correction):...
(1) odpowiedzi
2017-01-08 20:01 Postgresql stores timezone information in TIMESTAMP WITH TIMEZONE? »
I'm trying to understand how PostgreSQL handles TIMESTAMP WITH TIMEZONE type, and I 'm running into the discrepancy between theory and practice. Acco...
(1) odpowiedzi
2017-01-08 01:01 Allocate ranges of primary key integers »
Given RangeA of auto-incrementing primary key integers (1 to 32767) and RangeB (32768 to 2147483647). If a condition is true, save an object with a pr...
(1) odpowiedzi
2017-01-08 01:01 Postgresql - unrecognized configuration parameter »
I exported a postgresql database from an external server, and attempted to import it into my local server but got this error: unrecognized configurat...
(1) odpowiedzi
2017-01-07 18:01 Using an ActiveRecord class_name with pluck issue »
I have a model: class Entry < ActiveRecord::Base belongs_to :organization belongs_to :detail_organization, class_name: "Organization" end an...
(1) odpowiedzi
2017-01-07 14:01 SQL Trigger information »
I have a general question about Triggers. Is there anyway to program the SQL database in a way that whenever a trigger is fired, SQL tells us what row...
(1) odpowiedzi
2017-01-07 12:01 How can this postgresql query return as table? »
I am trying to call modules which in specific course but it returns as error: more than one row returned by a subquery used as an expression Query: ...
(2) odpowiedzi
2017-01-06 20:01 Issue with case when SQL »
I have a table named 'candidate' which contains among others columns ,score_math' and 'score_language' reflecting candidate's score in respective test...
(2) odpowiedzi
2017-01-06 15:01 How to identify and aggregate sequence from start and end dates »
I'm trying to identify a consecutive sequence in dates, per person, as well as sum amount for that sequence. My records table looks like this: person...
(2) odpowiedzi
2017-01-06 10:01 Migration of Django field with default value to PostgreSQL database »
https://docs.djangoproject.com/en/1.10/topics/migrations/ Here it says: "PostgreSQL is the most capable of all the databases here in terms of schema ...
(2) odpowiedzi
2017-01-05 22:01 PostgresSQL using sum in where clause »
I have a table which has a numeric column named 'capacity'. I want to select first rows which the total sum of their capacity is no greater than X, St...
(2) odpowiedzi
2017-01-05 20:01 Postgres bulk INSERT function using JSON arguments »
Here's a plpgsql function for postgres 9.6. It tries to INSERT a row, and if the insert doesn't fail (due to a key constraint violation), then it runs...
(1) odpowiedzi
2017-01-05 16:01 error with inner join - table not found although it's there »
SELECT * FROM "animalTbl" INNER JOIN "deathTbl" ON animalTbl.animalID = deathTbl.animalID; this is my code, and when I run it shows a problem ...
(2) odpowiedzi
2017-01-05 16:01 Rails 4: Advanced Query for Search Interface »
I need to perform a query on my model that allows me to test an array of tags (belongs_to :recipe) class Recipe < ActiveRecord::Base has_many ...
(1) odpowiedzi
2017-01-05 11:01 PostgreSQL json(b) - Convert string to array & update field »
I have a jsonb field in PostgreSQL with the following content: { "object": { "urls": "A;B;C" } } What I want to do is update the value of urls insid...
(1) odpowiedzi
2017-01-05 08:01 Issue with Sqlalchemy and inserting array of jsonb to postgresql »
So i'm trying to insert an array of jsonb values into my database but I can't seem to format it right, here's my code: updated_old_passwords.append({...
(0) odpowiedzi
2017-01-05 05:01 Django inspectdb skips tables with constraints »
I read a few topics on this, but none really seemed to offer a solution in inspectdb, or an alternative, that permits Django to make models for an exi...
(0) odpowiedzi
2017-01-04 18:01 Sorting in Rails: SQLite vs PostgreSQL »
When I order by a column (id type INT) in Rails 5 with sqlite as the development db, it sorts as expected (1,2,3,4...) but the same thing on my produc...
(1) odpowiedzi
2017-01-04 15:01 How to COPY CSV as JSON fields »
Is there a way to COPY the CSV file data directly into a JSON or JSONb array? Example: CREATE TABLE mytable ( id serial PRIMARY KEY, info jS...
(1) odpowiedzi