Questions tagged [postgresql-9.4]
for PostgreSQL questions specific to version 9.4
1,296
questions
0
votes
0
answers
4
views
Postgres 9.4 Geo Lookup with IPV6 INET
I have two table in postgres 9.4.
table1 includes records from website visits.
table1 has three columns: IP(type INET and IPV6 addresses), date, event_id and receives ~ 50K records a day.
||ip||date|...
0
votes
0
answers
128
views
I am using pgAdmin 4, PostgreSQL 16, Windows 10. Whenever I try to login into pgAdmin for postgres user, I get can Connection TImeout Error
I am using pgAdmin 4, PostgreSQL 16, Windows 10. Whenever I try to login into pgAdmin for postgres user, I get can Connection TImeout Error.
I tried reinstalling postgreSQL, running pgadmin 4 in ...
0
votes
1
answer
42
views
How to pass params in function at for in select loop end loop
I have a function with 2 char params. I tried pass it by order $1 $2, by name with and without a colon and via alias. it doesn't work - I get an empty result. When passing values instead of parameters,...
0
votes
1
answer
36
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
65
views
PostgreSQL - Find corresponding table of a LOB
I'm using PostgreSQL 9.4.
When a table A uses a LOB, PostgreSQL stores it in a separate table, pg_largeobject, and table A holds a reference to an entry in pg_largeobject.
Given a LOB entry in ...
0
votes
1
answer
143
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
1
answer
74
views
Dynamic column names in the Postgres query
I have one table with a bunch of fields. For simplicity, assume 5 fields:
unique_id, currency_name, stock_description, company_name, city_name
say, the sample values are:
INTQL123, USD, "INT ...
0
votes
2
answers
100
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
2
answers
136
views
how to insert multiple commands into a prepared statement
The problem is that putting queries together, I got this "error: cannot insert multiple commands into a prepared statement". What can I do?
q1="
set search_path to care;
SELECT ...
0
votes
0
answers
108
views
In Pgadmin Portal, I need to create a user for readonly access and user not able to create a table also in public
I used this query
\`-- Create a user with read-only access
CREATE USER read3 WITH PASSWORD 'password';
\-- Grant necessary privileges for read-only access
GRANT CONNECT ON DATABASE auditdb, ...
0
votes
0
answers
34
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 (
(
...
0
votes
1
answer
50
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() ...
-2
votes
1
answer
141
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
0
answers
26
views
pyscopg2 select causing undefinedcolumn error for this below program
I am new to postgresql and python. Could you please help me to fix this issue. I am getting undefined column error while fetching with where caluse. PostgreSQL 14 and python 3.8 version has been used.
...
0
votes
3
answers
43
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
0
answers
67
views
Is there any way to identify the unused Column in PostgreSQL?
I need to identify the table and particular columns which are not used and not updating by the app. based on the analysis we need to migrate db.
we tried to run queries but not getting the result that ...
0
votes
1
answer
70
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
votes
2
answers
108
views
create dynamic column from a column with multi variables
Looking to Split Hobby column to N multiple columns in PostgreSQL 9.4, where each column header shows the Hobby.
Original table
Name
Hobby
Rene
Python, Monkey Bars
CJ
Trading, Python
Herlinda
...
1
vote
1
answer
60
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
2
answers
37
views
Why is CASE - WHEN - ELSE not working for me in pgadmin in this once instance?
Working with postgres 9.4 and using PGAdmin III: I have a schema with a character field that MAY contain "new lines" (NLs), or MAY contain double spaces, or neither. I need to divide the ...
0
votes
1
answer
74
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
50
views
Postgresql function return table? with different number of columns each time
I have a table called all_checks(code integer,sql_state text) that have some checks on my db.
My table all_checks is like:
code
sql_state
100
select kind,discs,bands from music where kind='rock'
...
0
votes
1
answer
80
views
unable to create dynamic table using function with execute format option in postgresql
i am trying to create dynamic table using function however i am getting error.
my code as below.
create or replace function fn_while_loop_upd_table(val int) returns BOOLEAN as
$$
DECLARE lv_count ...
0
votes
0
answers
59
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 ...
0
votes
1
answer
41
views
Can I use the result set of an SQL statement stored in a field within another statement? (PostgreSQL)
I have an sql statement stored in a PostgreSQL 9.4 database. Can I use the stored statement, select it within another statement and use the result set as a table?
For example: In the table "...
1
vote
1
answer
343
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
1
answer
60
views
how to take where query as input in postgres using python
I am trying to take where query as input in Postgres using python.
Can anyone help me?
cur.execute("SELECT * from home_curd where consumer_type="+a)
0
votes
0
answers
32
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"
...
1
vote
0
answers
499
views
Class that has nested array properties in typeorm
I'm using TypeORM with Postgresql and having trouble creating entity file with nested scheme
The records I would like returned from my database should look like this:
[{
id: 1,
name: 'john'
...
0
votes
0
answers
135
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
120
views
Delete a value from jsonb array data having no key in postgresql
Table structure is:
CREATE TABLE mine_check.meta
(
sl_no bigserial NOT NULL,
tags jsonb NOT NULL DEFAULT '[]'::jsonb
);
Table looks like
sl.no tags
1 [120,450]
2 [120]...
1
vote
1
answer
69
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 $...
0
votes
1
answer
193
views
Azure configure backup doesn't see PostgreSQL
I am trying to configure a backup of the PostgreSQL server using the Azure backup center.
I created Vault, a resource group. But when I am trying to configure backup using Vault and Backup policy it ...
2
votes
0
answers
865
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 ...
0
votes
1
answer
119
views
Postgres 9.4 - Check if a table exist in database
I would like to know if Postgresql has implemented a function that runs automatically and returns me if a table is created in the database independently of the schema.
version : Postgresql 9.4
Thanks!
1
vote
2
answers
562
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 ...
1
vote
1
answer
1k
views
How to Add Multiple JSON_BUILD_OBJECT entries to a JSON_AGG
I am using PostgreSQL 9.4 and I have a requirement to have an 'addresses' array which contains closed JSON objects for different types of address (residential and correspondence). The structure should ...
0
votes
0
answers
56
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 ...
0
votes
1
answer
452
views
Error when using `on conflict` on postgresql query
I've the following table on PostgreSQL:
-- Table: product_ohlcv_history
-- DROP TABLE product_ohlcv_history;
CREATE TABLE product_ohlcv_history
(
broker_uuid uuid NOT NULL,
product_id character ...
0
votes
1
answer
655
views
How to select aggregate discount percentages and flat amount?
I have a scenario whereby I need to aggregate n number of discounts to get a total discount. Each discount must be applied net of the previous discount.
For example: I have an order of 200 Rs. (Sum of ...
0
votes
1
answer
2k
views
Postgres check if value exists in a json field (without knowing key)
I have a json column in postgresql, with a structure like so:
json_col:
{
"key1":["value1","value1.1"],
"key2":["value2"]
}
This would be one field ...
0
votes
1
answer
2k
views
How can I change my postgresql WAL file size?
How can I change my PostgreSQL WAL file size as my wish. By default at pg_wal directory postgres generate 16MB WAL files. I try to change using max_wal_size, min_wal_size parameter. But I think it is ...
0
votes
1
answer
93
views
How to check the query has values and get the difference of the start date and end date in intervals in postgres SQL?
These are the summary of issue:
There is an issue of not going inside the if clause and data not inserted.
Need to compute the target_progress_date as the difference between the end_date and ...
0
votes
1
answer
1k
views
While trying to drop 10000 tables in one short in postgres sql getting error out of shared memory increase max_locks_per_transaction
out of shared memory HINT: You might need to increase
max_locks_per_transaction.
We are passing input as comma separated tables table_names and trying to drop a huge
set of table
CREATE OR ...
1
vote
0
answers
183
views
How to copy subset of a table from one database to another?
So I have a table, person_table:
name
age
gender
john
21
M
abraham
32
M
I want to copy name and gender columns of this table from one database to another on another server. So I have the following ...
2
votes
2
answers
60
views
group by with another row aggregate function
I am trying to get the max salary from the department column but I also
want to know the person in that certain department.
what can I do here?
create table if not exists employee(
id serial ...
0
votes
0
answers
168
views
Postgres on conflict
CREATE FUNCTION get_or_create_id(scheduleid integer,member_id character varying, user_id integer,role_id integer, _appointment_date timestamp without time zone,active boolean) RETURNS INT AS
$$
WITH ...
1
vote
0
answers
120
views
Postgres FDW - Triggers to update local schema when remote schema has a DML
I have a client website that has a Postgres backend which I consider as my remote database. I use FDWs to connect from my local database to the remote DB.
So what I have is :
Remote DB ->remote ...
0
votes
1
answer
73
views
PostgreSQL Function and trigger in postresql to contain changes
I want to implement a function and a trigger (without parameters) that allow making changes in a table B as long as they are made in table D. What I mean by changes is insertions, updates or deletions....
-2
votes
1
answer
813
views
Which is more efficient - Multiple rows or multiple columns?
Each user will use this data at least 15 times when they are logged in. So READ is more important.
So i have two approaches, i know this is a rookie question but I am just confused between the options:...