Questions tagged as 'postgresql'

1
answer

Always include records from another table if the value of the related field is not NULL

I'm doing a query query, based on a table. In this table (tableA) I bring several records from other tables, with some codes but one in particular is giving me a certain headache. There is a record in tableA that can be NULL and in this ca...
asked by 09.12.2014 / 19:59
1
answer

SELECT to fill a field

Good afternoon, I have a table called Pessoa and another Matricula , I need to make a query that returns the fields name , enrollment and seq_people , where name and seq_people are in the Pessoa table and matricula in...
asked by 07.11.2018 / 20:03
1
answer

How to create COLLATION for Brazilian Portuguese

In documentation says to create collation like this: CREATE COLLATION french (LOCALE = 'fr_FR.utf8'); This example is for France. What would it be like for Brazilian Portuguese?     
asked by 31.10.2018 / 19:33
2
answers

JOIN with LIMIT in Query

I have the following tables with the information below: RESERVATION : id| checkin | checkout | titular | valor --+------------+------------+---------+-------- 1 | 2018-09-01 | 2018-09-02 | BOOKING | 300 2 | 2018-09-03 | 2018-09-05 | B...
asked by 26.10.2018 / 21:18
1
answer

Column ambiguous

I have a code problem that I can not understand. The postgres always points to the error _ "column reference" pro_codigo "is ambiguous" _, however I gave the "nicknames" the column pro_codigo . I can not see the meaning. SELECT DISTINC...
asked by 09.10.2018 / 19:17
3
answers

Call database function that receives a list as parameter

People like I do the following ... involves database (Postgres SQL) and JPA, I want to create a database function that gets a list of ids as parameter and make a query cm in the WHERE IN (. ..). In JPA how do I call this function, and how do I p...
asked by 20.10.2018 / 15:21
1
answer

Concatenate rows with the same code

When executing the query select * from ivr_interacao,ivr_business where ivr_interacao.codigo = ivr_business.idvisita and ivr_business.campanha = 5 order by start_time asc I have the following answer: CHAMADO ID VISITA NOME TELEFONE...
asked by 28.06.2018 / 17:14
1
answer

PostGre - Field Id (Integer) of a table can go from 1 to how much?

I have a table in PostGre whose Id field is of type Integer and primary key. As records are being saved, numbering ranges from 1 to how much? I'm used to the Dataflex database, where table records (by default) start from 1 and go up to 999999...
asked by 20.06.2018 / 15:04
1
answer

How to audit records by saving changes in JSON

I'm using a function to audit records in insert, update, delete events for a PostGres 9.6 table . I took the script from the Git-audit-trigger The script has been implemented and is working perfectly, but one of the results it brings m...
asked by 21.06.2018 / 16:29
1
answer

increment rows based on a record in postgresql

I have a query that returns the quantity and initial value and I want to turn this query into multiple rows by quantity. Example: Inquiry: select 3 as numero, 10001 as valorinicial Expected output: id | valor ---------- 1. 1000...
asked by 20.07.2018 / 17:40