Questions tagged as 'postgresql'

2
answers

How to create a Postgresql stored procedure from a Java code

Searching the internet for a solution to create a database on a Postgresql server for my Spring project, I found the following topic in StackOverflow: link where the following Stored procedure exists for this task: DO $do$ BEGIN IF EX...
asked by 07.05.2014 / 16:01
1
answer

Something wrong with if in the controller Laravel

I have a function in a laravel controller, at first it seems to be working fine but when it goes through the "if" part it jumps straight to the "else", here is the code that is in the controller: //Inserção de troca(transicao) e decremento na t...
asked by 06.12.2018 / 18:41
1
answer

Postgres: Error converting data in Postgres 10

When I run a date conversion on postgres 9.6 that I have on my machine, it corrects the date if it is invalid, the same is not happening in postgres 10 that is on another machine: Postgres 9.6 DateStyle = ISO, DMY server_encoding = UTF8...
asked by 26.12.2018 / 18:53
2
answers

select month and year from a datetime field

I have a field of type datetime and I need to do a query based only on the month and year. When searching, I noticed that there is a extract function, but it separates only one value from datetime . example: SELECT * FRO...
asked by 05.11.2018 / 15:12
1
answer

SQL Query with multiple arguments

I need to create an SQL query that may or may not have multiple arguments. Example: Pesquisa 1: "João Goiânia" Pesquisa 2: "Goiânia João" Pesquisa 3: "João Advogado Goiânia" The query should go through three fields: name, city, profession....
asked by 31.08.2018 / 21:29
1
answer

Multi-tiered development and business rule

I work with a team developing an ERP and I am responsible for issuing reports, one of which executes a select in the bank that in tests took more than 2 hours running, which led to errors and a big doubt: who was processing all the inform...
asked by 26.11.2018 / 19:53
1
answer

Postgresql - Trying a rollback in a function

The relationship structure between tables below is not the most convenient and technical. It's just to illustrate what I need. I've read quite a few articles about function, trigger functions and I'm having a problem, because in one part I go...
asked by 10.11.2018 / 13:47
1
answer

Script to change table names in the PostgreSQL database

I have this script: SELECT n.nspname AS schema_name, c.relname AS table_name, c.reltuples::int AS num_reg FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace WH...
asked by 02.10.2018 / 04:47
1
answer

SQL Alphabetical ordering with html code

I have a table that contains the titulo field. I have a query and I want to sort alphabetically by it, however, some fields are with HTML codes, I'll give examples:    Goat slaughtering and meat processing       Slaughter and Commerci...
asked by 18.07.2018 / 16:43
1
answer

Database connection problem with Docker

I migrated my application to a Docker container, it was working fine, until one moment I had to change the bank population scripts and I recreated the bank, however I had this problem that I do not know how to solve, I already tried to modify th...
asked by 23.07.2018 / 19:48