Questions tagged [postgresql]
PostgreSQL is an open-source, object-relational database management system (ORDBMS) available for all major platforms including Linux, UNIX, Windows and OS X. Please mention your exact version of Postgres when asking questions. Questions concerning administration or advanced features are best directed to dba.stackexchange.com.
106,720
questions
0
votes
0answers
8 views
How do I return a promise error on the front end
I am trying to execute a Postgresql query which appends data to an array for a specific id, and if the query is not able to update any rows, it should return an error on the front end. However, right ...
0
votes
0answers
13 views
Alter check constraint on Postgres domain
Given an existing Postgres DOMAIN with CHECK constraint:
CREATE DOMAIN code as CHAR(1)
CHECK (value IN ('A', 'B', 'C'));
I need to alter the CHECK constraint to add D as a member to the valid set A,...
0
votes
0answers
12 views
Rails: are there performance implications of single table inheritance?
Using Rails (5.2.3) and Postgres (9.6.6), I'm planning a new model for a large table (~20 million rows and counting, initially).
I'm trying to decide whether to use single table inheritance (STI) or ...
0
votes
1answer
12 views
PSQL Select Statement, Does Not Exist
ERROR: column "countis" does not exist
and
ERROR: column "percentage" does not exist
occur as errors
What is the error i'm making, presumably not that complex of an error.
select ...
0
votes
0answers
18 views
How to structure models for forecasting app?
In Django, I am looking for recommendations on how to structure models for a forecasting app that is similar to a polling or quiz app - but not quite.
Overview of requirements:
(1) A quiz will have ...
1
vote
1answer
25 views
What is the correct syntax for getting timestamps before a certain time?
I would like to return all the timestamps from a database as long as they are before 6 am on the day they were made. I tried to do this:
SELECT source_created_at AT TIME ZONE 'US/PACIFIC' FROM ...
0
votes
1answer
18 views
Substract Results From 2 Queries
I have 2 queries that give same results (same columns, rows) but with different data. I need to subtract the results from one column of query #1 to the same column but from query #2.
This are my ...
0
votes
0answers
5 views
how to include model, when model.create in sequelize
I have a function that adds a post, how would i go about appending the user associate who made post. Right now it gets the author id, i want it to show the username
I'm aware of using Include, but ...
0
votes
1answer
18 views
What's the exact type of lock PostgreSQL acquires when performing an `UPDATE`?
I'm aware that programmers have the option to acquire explicit locks when performing database operations, but I'd like more clarity into what type of lock Postgres acquires (automatically) when ...
0
votes
0answers
14 views
AdonisJS Query not functioning correctly
I'm working on learning AdonisJS better and am working on a project while I learn.
The project is a social-like clone and I'm attempting to pull in only users I follow in an activity feed showing ...
1
vote
2answers
23 views
How can I prevent my SQL subquery from caching data in PostgreSQL?
I'm trying to insert test data to test postgresql partionning, using Postgresql 11.
Here is my table:
CREATE TABLE measurement (
city_id int not null,
logdate date not null,
...
0
votes
0answers
13 views
Datadog Configuration for Postgres 9.6
I have a question about the configuration setting for datadog for postgres 9.6.
(1) How do I get all databases monitored in datadog?
(2) How do I get all table level metrics from each database/schema?...
0
votes
0answers
14 views
Is it possible in Django to insert data in var/dynamic table name via Models META?
Thank you for reading i am new to Django and
For my application it's a requirement to create a table for each client to store his data.
Each client table has the same data so i made a Model for ...
0
votes
2answers
18 views
Array_agg on 2 columns with output not recognized as list
I'm using array_agg in one of my Postgresql query in Python using psycopg2.
The issue I'm finding is when looping through the resulting rows.
The generated column from the query doesn't understand ...
0
votes
0answers
7 views
Spring JPA with criteria builder convert timestamp with timezone to local time with given time zone
I am using PostgreSQL as db, i have a timestamptz column
I want to convert it into given timezone.
select
shipment0_.estimated_delivery_date_time at time zone 'IST'
from
shipment shipment0_
is ...