1,830 questions
0
votes
0
answers
60
views
SequelizeEagerLoadingError: ModelA is not associated to ModelB (intermittent in multi-schema setup)
I'm using Sequelize v6.37.5 with PostgreSQL in a multi-tenant architecture, where each tenant has its own schema. Models are defined once globally, and we use .schema(schemaName) to access tenant-...
0
votes
0
answers
80
views
Tracking Events in PostgreSQL: Does It Have a Profiler?
I have worked with Microsoft SQL, and it was very easy to find the tables and stored procedures that were being called when an event occurred in the application. It helped a lot in identifying the ...
1
vote
1
answer
155
views
How to set replica identity full for a table having different owner?
I have two owners in my postgresql database e.g. testdb, I have some tables of owner1 and some tables of owner2. I am facing issue in setting replica identity full for tables of owner1 using owner2 ...
1
vote
1
answer
363
views
Mixing of ? parameters and other forms like ?1 is not supported Postgres
I am trying to create a native query using spring JPA for the below query. I am trying to filter the data where the jsonB contains the filtered key.
select * FROM targeted_event_catalog e WHERE e....
0
votes
1
answer
80
views
Select only distinct values from two tables on pgadmin without getting all combinations
I have two tables.
table 1
Column A
Column B
rgz
1
dry
1
vgy
2
chy
3
pom
2
table 2
Column C
Column D
tuv
10
tuv
11
chx
22
lmn
34
I want the following result shown on data output of postgres PgAdmin
...
1
vote
0
answers
39
views
How can I do weekly tracking in the log table?
I have a log table in which I keep user login records.
CREATE TABLE public.login
(
id bigint NOT NULL,
copy_id bigint,
create_date timestamp without time zone,
version integer NOT NULL DEFAULT ...
0
votes
2
answers
336
views
Can Windows "Compress contents to save disk space" folder option yield PostgreSQL erratic behavior?
I'm maintaining an old PostgreSQL-based application (PostgreSQL 9.1.22) on a Windows 2012 Server and we have noticed some data integrity inconsistencies. No errors have been spotted in logs nor in the ...
0
votes
0
answers
91
views
Postgres sort order results in different orders for different clients
Azure DB for Postgres flexible server
I have Azure DB for Postgres flexible server. I have created a database in this server with en_US.utf8 collation. In this database I have created a table with ...
0
votes
1
answer
50
views
How to get an array of joined table in sequelize in findAll()
const response = await OrderDal.findAll({
where: { buyerId: userId },
attributes: { exclude: ['outcomeId', 'programId'] },
include: [
{
model: User,
as: 'buyerOrders',
...
0
votes
1
answer
45
views
Converting mysql to Postgre query - could not find proper alternative for information_schema.STATISTICS
I have a query in mysql, trying to convert to Postgre, I could not find 'information_schema.STATISTICS' equivalent in Postgre. Is there any way to achieve in Postgre.
Full Query:
SELECT t.TABLE_NAME ...
0
votes
2
answers
306
views
Need help configuring PostgreSQL connection to behave like MySQL: Connect to server without auto-selecting default database
In mysql when I enter the following
mysql -u root -p
Password: enter password successfully
I then get into my local server and from here I can view all my databases using SHOW DATABASES. But when I ...
0
votes
1
answer
611
views
How to get past "query returned no rows" in Postgres?
I have a project on Supabase and I've wanted to implement TCE to encrypt a certain column.
I am running into errors when trying to insert into my table which has an encrypted column.
Here is my table ...
0
votes
0
answers
17
views
Is 'ON CONFLICT' support in PosgreSql Version 9.1.11? [duplicate]
I have an error with code 'ON CONFLICT' when I use PostgreSQL with version 9.1.11
0
votes
2
answers
92
views
Rolling data using Average
Is postgresql can do average for rolling data? I have this case where I need to average the values for 5 days and get all the days filled up while waiting for the actual values so basically if I'm in ...
1
vote
1
answer
212
views
Dynamic json data fields extract into columns in postgres
I want to extract data from json and put into columns.
create table mytable (id integer,data jsonb);
insert into mytable (id,data) values(25,'{"_id":25,"indicator 1":"yes&...
0
votes
1
answer
236
views
Can we add custom aggregated value in Elastic Search
I have three tables Customer, Product and Transactions. I have used Elastic Search to build index joining the three tables. The output of the index looks something like this
{
"customer_id&...
0
votes
1
answer
119
views
How to increment rows by 1 from a certain range in postgresql
I have a table and multiple rows in it.I want to increment rows of port column by 1 which is above certain range.(this certain range i am getting from another query)
I tried using row_number() over() ...
1
vote
0
answers
410
views
Debezium is not pushing data to kafka from postgresql
I am trying to do CDC using debezium on postgresql. I ran the following docker images
> ZOOKEEPER
docker run -it --rm --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888
quay.io/debezium/...
3
votes
2
answers
1k
views
How to create a read-only user in Azure PostgreSQL?
I'm trying to create a new user in postgresql which have read only access to Databases. I followed this document I will just list out the commands I used
CREATE ROLE readaccess;
GRANT CONNECT ON ...
0
votes
2
answers
85
views
sql how to select row based on json format field value?
I have a table ,one of the table filed is json format:
my_table
id json_field
1 { "to_status": 7, "to_status_name": "In Progress", "role": "admin"...
1
vote
0
answers
595
views
how to alter table to add two or more foreign keys
I tried using the code below to add two foreign keys to the table products but it wont add foreign keys if i run the two on one run, they work individualy but not if i code it the way below:
ALTER ...
1
vote
0
answers
112
views
How to drop a constraint starting with number in postgresql ? For ex : 123_5_pk_not_null
While dropping constraint named 123_5_pk_not_null, I am getting syntax error at the start of constraint name.
Query:
alter table table_name drop constraint 123_5_pk_not_null;
Error:
Syntax error at ...
0
votes
1
answer
1k
views
Upgrading from postgresql 9 to 11
I'm using a Linux server, I want to upgrade postgresql from the version 9 to 11. I have created a dump of my database. Then I have installed postgresql 11, now I want to import the dump to postgresql ...
1
vote
1
answer
87
views
How to move the only updated row to the hist_table postgres?
I Created the next Trigger to move the data from a main table to an historical table in case of an update or insert.
CREATE OR REPLACE FUNCTION process_employee_hist() RETURNS TRIGGER AS $...
1
vote
1
answer
101
views
SQL merge row values in a column
TABLE 1
CODE
VALUE
AA
21
AA
32
AB
24
AC
22
AA
42
AC
20
AD
27
AD
28
AE
29
AF
31
AG
45
AE
51
AH
33
TABLE 2
CODE
KEY
AA
1
AB
2
AC
3
AD
4
AE
5
AF
6
AG
7
AH
8
Here i want to transform the table in such a ...