postgresql-11

Can a Postgres Commit Exist in Procedure that has an Exception Block?

余生颓废 提交于 2020-06-08 07:21:11
问题 I am having a difficult time understanding transactions in Postgres. I have a procedure that may encounter an exception. There are parts of the procedure where I might want to commit my work so-far so that it won't be rolled back if an exceptions ensues. I want to have an exception handling block at the end of the procedure where I catch the exception and insert the information from the exception into a logging table. I have boiled the problem down to a simple procedure, below, which fails on

Naming issues on Oracle Packages conversion to PostgreSQL using Aws SCT tool

早过忘川 提交于 2020-04-18 05:35:13
问题 I had migrated Oracle db to Aurora postgreSQL with the help of AWS SCT tool. All packages and triggers are converted as functions in PostgreSQL. My issue here is all the names are converted with a $ (dollar) symbol. for example, A package and associated stored proc in Oracle pk_audit.sp_get_audit converted to postgreSQL as pk_audit$sp_get_audit with a $ symbol. but, In the middleware db object name is pk_audit.sp_get_audit . In order to minimise the effort on the middleware, I need to convert

Laravel 5.5 why is exception not thrown by foreign key violation from delete method?

我是研究僧i 提交于 2020-01-20 06:08:28
问题 Update 3: This problem from 9 months ago persists with Laravel 5.8 and Postgresql 11 on Windows 10 in a Laragon environment and Apache 2.4 on an Ubuntu machine. Does the Eloquent Model instance delete() method simply ignore foreign key constraints? It's baffling: I have two tables in a Postgresql 9.3 database, companies and sites. There is a one-to-many relationship between them with companies on the one side. There is a foreign key constraint that prevents the deletion of a company if sites

Laravel 5.5 why is exception not thrown by foreign key violation from delete method?

∥☆過路亽.° 提交于 2020-01-20 06:07:38
问题 Update 3: This problem from 9 months ago persists with Laravel 5.8 and Postgresql 11 on Windows 10 in a Laragon environment and Apache 2.4 on an Ubuntu machine. Does the Eloquent Model instance delete() method simply ignore foreign key constraints? It's baffling: I have two tables in a Postgresql 9.3 database, companies and sites. There is a one-to-many relationship between them with companies on the one side. There is a foreign key constraint that prevents the deletion of a company if sites

Parallel append on foreign tables in PostgreSQL 11

最后都变了- 提交于 2020-01-05 13:09:32
问题 Is it possible to achieve parallel append on foreign tables in PostgreSQL 11 (just like on local tables)? Local tables: # select version(); version --------------------------------------------------------------------------------------------------- PostgreSQL 11beta3 on x86_64-pc-linux-gnu, compiled by gcc (Debian 4.9.2-10+deb8u1) 4.9.2, 64-bit (1 row) # create table local_table_1 as select generate_series(1, 1000000); SELECT 1000000 # create table local_table_2 as select generate_series(1,

FATAL: password authentication failed for user “postgres” (postgresql 11 with pgAdmin 4)

ぐ巨炮叔叔 提交于 2020-01-02 05:15:10
问题 I recently installed Postgresql 11, during the installation, there's no step to put password and username for Postgres. Now in pgAdmin 4, I wanted to connect the database to server and it's asking me to input password, and I haven't put any in the first place. Any one knows what's going on. Thank you! 回答1: You could access your pgpass.conf via pgAdmin -> Files -> open pgpass.conf That will give you the path of pgpass.conf at the bottom of the window (official documentation). If you then open

PostgreSQL 11 foreign key on partitioning tables

北城余情 提交于 2019-12-21 12:36:51
问题 In the PostgreSQL 11 Release Notes I found the following improvements to partitioning functionality: Add support for PRIMARY KEY, FOREIGN KEY, indexes, and triggers on partitioned tables I need this feature and tested it. Create table: CREATE TABLE public.tbl_test ( uuid character varying(32) NOT null, registration_date timestamp without time zone NOT NULL ) PARTITION BY RANGE (registration_date); Try to create Primary key: ALTER TABLE public.tbl_test ADD CONSTRAINT pk_test PRIMARY KEY (uuid)

I need a function to select 88 random rows from a table (without duplicates)

三世轮回 提交于 2019-12-13 17:24:54
问题 I have a table with a few columns (id, description, created (timestamp) and ipaddress). I have inserted 200 rows as dummy data. I need a way to pull 88 random rows with no duplicates from that table. I have tried this: create or replace function GetRandomCrazy88() returns setof varchar(255) as ' select description from task left join tagassignment t on task.id = t.taskid order by random() limit 88; ' language 'sql'; But this returns duplicate rows. I also tried this (it got a bit out of hand)

pass unknown number of parameters to IN clause using JDBC and Postgres

房东的猫 提交于 2019-12-11 16:46:31
问题 My query looks like this, and performs well: select * from table t where (t.one,t.two,t.three) in ( (11,12,13), (21,22,23) ); Now the number of these triplets within the in statement will vary, so I'm trying to do the following with JDBC: String sql = "select * from table where (one, two, three) in (select * from unnest(?::smallint[], ?::integer[], ?::integer[]))" // conn is the java.sql.Connection PreparedStatement ps = conn.prepareStatement(sql); ps.setArray(1, conn.createArrayOf("smallint"

PostgreSQL queries not killed on app server shutdown

若如初见. 提交于 2019-12-11 15:18:40
问题 I have a WildFly which hosts an app which is calling some long running SQL queries (say queries or SP calls which take 10-20 mins or more). Previously this WildFly was pointing to SQL Server 2008, now to Postgres 11. Previously when I killed/rebooted WildFly, I had noticed that pretty quickly (if not instantaneously) the long-running SP/query calls that were triggered from the Java code (running in WildFly) were being killed too . Now... with Postgres I noticed that these long running queries