All Questions
Tagged with postgres-9.4 or postgresql-9.4
1,316 questions
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 ...
0
votes
1
answer
37
views
SQL query to fetch org level data
I need to derive a few fields based on below input data. I have 2 input tables:
Table 1:
badge
l1_mgr_id
l2_mgr_id
l3_mgr_id
l4_mgr_id
l1_mgr_name
l2_mgr_name
l3_mgr_name
l4_mgr_name
cost_center
12
...
0
votes
0
answers
100
views
postgres btree index unique constraint does not work
I have a table accounts_coin with unique constraint on (type, id), but it still have two rows with same value of (type, id), this image shows the problem: click
information might help:
postgres ...
0
votes
1
answer
119
views
Postgres sql to perform join
Just general question, can anyone pls help how to perform left join on union data. I have query where I am doing union of data(using table1 and table2) based on few conditions now I need to perform ...
1
vote
1
answer
112
views
Syntax error at or near "perform" on Recursive Query
I'm using a stored procedure to get the total query execution time in PgAdmin.
Based on some readings, I tried the following:
DO $proc$
DECLARE
StartTime timestamptz;
EndTime timestamptz;
Delta ...
1
vote
1
answer
118
views
Compare fields Where One is Similar to Part of Another in Postgres sql
I would like to write a Select query where I can see if one column is like part of another column in different table postgresql.
tblNames1:
ID
Description
target table
1
select test....
0
votes
0
answers
136
views
How to unnest and order an array
Is there a way to specify the order of unnesting a string from an arrary? I'm building a report in sql that takes a description of a baseline_intake_form for cars and takes the response the customer's ...
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
46
views
How to execute select which stored cell in table
I have a tune table that stores SOAP requests. Some parts of the query are constant, some parts are variable. To get the values of the variables, i need to perform another select whose text is stored ...
0
votes
1
answer
971
views
No procedure matches the given name and argument types. You might need to add explicit type casts. POSTGRESQL
I apologize in advance for my English. I'm new to programming. There is a problem with stored procedures in PostgreSQL.
I have a table:
CREATE TABLE user
(
Id serial,
idGroup INTEGER,
...
0
votes
2
answers
620
views
I am confused with PostgresQL/Timescale indexing
I have created a table like this
CREATE TABLE IF NOT EXISTS public.table_name(
id SERIAL PRIMARY KEY,
user_id int4 NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
);
SELECT ...
0
votes
0
answers
38
views
My DISTINCT SQL query taking long time to execute in PostgreSQL
I have more than 50 million rows and its taking hours to get this query done:
select distinct column_1
from table_1
where "colour" = 'red';
I tried this:
WITH RECURSIVE cte AS (
(
...
-2
votes
1
answer
265
views
ERROR: syntax error at or near "[" in Postgres SQL
UPDATE s SET sb = sb ||
('{"filded": [{"@value": ' ||
sb@>>'{filded,0, @value}'::integer + 1 ||
'}],"lastFailure &...
0
votes
3
answers
47
views
How to get the difference between the first two records for each unique record in SQL?
I have a table:
evt_type | value | time
------------+------------+--------------------
2 | 5 | 2015-05-09 12:42:00
4 | -42 | 2015-05-09 13:19:57
2 ...
0
votes
1
answer
88
views
Looking for a PL/PGSQL function to return N columns
Run in a PL/pgSQL a function to return N columns and put in a view or something that allow to get the table with the N column updated without human intervention.
Using the below code from:
create ...
1
vote
1
answer
79
views
postgresql - find Discontinuous id and get read_time
I have a table like this, and there are three cases,
## case a
| rec_no | read_time | id
+--------+---------------------+----
| 45139 | 2023-02-07 17:00:00 | a
| 45140 | 2023-02-07 17:15:...
0
votes
1
answer
240
views
How to concat substrings with regexp_matches (as analogy regexp_substr in teradata) in Postgres 9.4
I am having migration from teradata to greenplum and there is a string concatenation with regex_substr which is not existing at Postgres 9.4 version.
The part of the existing code is:
TRIM(COALESCE(...
0
votes
0
answers
125
views
Python Postgres multiple delete
Want to delete data from multiple tables.
As i understood, there is no way to do it via join/using in Postresql (currently 9.4). It is possible to delete only from one table at a time.
Trying like ...
2
votes
1
answer
1k
views
From postgres to greenplum via pxf UUID and INET types aint' supported?
So I am creating external table in greenplum based on the table i have in postgres.
And When I create field
field_name uuid
I am getting an error "Field type UNSUPPORTED_TYPE" Same goes to ...
0
votes
0
answers
34
views
ERROR: recursive inside the trigger function
This my trigger that will trigger if new value is inserted in origin.
I want to store the result of recursive to table(extract).
I get this error
ERROR: syntax error at or near "perform"
...
0
votes
0
answers
182
views
How do I import inet or uudi data as null from csv file?
I am using DBeaver tool for import csv file into postgres database. When Iam trying to import csv file which is having column (inet datatype) as null. Then I am getting the below error. Please let me ...
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 $...
3
votes
0
answers
1k
views
Check if enum type exists and add value
I'm new to PostgreSQl. I'm trying to add new values to type if type exists:
ALTER type ProcessStatus ADD VALUE IF NOT EXISTS 'Processing';
Above query will add 'Processing' to type ProcessStatus, but ...
1
vote
2
answers
1k
views
Can postgres insert triggers and/or check be ran without inserting
I would love to be able to validate objects representing table rows using the database's existing constraints (triggers that raise exceptions and checks) without actually inserting them into the ...
0
votes
0
answers
63
views
Postgres: return count with name of table and field by reference
I need pl/sql return count of the table ..
pass by reference the name of table and name of field
i´m using:
-- Function: fn_post_gera_chave_numerica(character varying, character varying)
-- DROP ...