Re: [GENERAL] COPY command & binary format

2016-05-10 Thread Pujol Mathieu
Le 10/05/2016 à 12:56, Nicolas Paris a écrit : Hello, What is the way to build a binary format (instead of a csv) ? Is there specification for this file ? http://www.postgresql.org/docs/9.5/static/sql-copy.html Could I create such format from java ? I guess this would be far faster, and

Re: [GENERAL] Unexpected result using floor() function

2016-03-14 Thread Pujol Mathieu
Le 14/03/2016 15:29, Merlin Moncure a écrit : On Mon, Mar 14, 2016 at 9:21 AM, Pujol Mathieu <mathieu.pu...@realfusio.com> wrote: Hi I reproduce your bug using "PostgreSQL 9.3.6, compiled by Visual C++ build 1600, 64-bit" on Windows 8 I also notice that SELECT floor(4.7

Re: [GENERAL] Unexpected result using floor() function

2016-03-14 Thread Pujol Mathieu
Hi I reproduce your bug using "PostgreSQL 9.3.6, compiled by Visual C++ build 1600, 64-bit" on Windows 8 I also notice that SELECT floor(4.725 * power(10, 2)::numeric + 0.5) work as expected Mathieu Le 14/03/2016 15:11, Frank Millman a écrit : Hi all I am running PostgreSQL 9.4.4 on Fedora

Re: [GENERAL] COPY command file name encoding issue (UTF8/WIN1252)

2015-03-23 Thread Pujol Mathieu
is not allowed. Sending him a text containing escaped WIN1252 hex value fails, because query parser detect invalid UTF8 sequence (which is logical). The problem is that I can't find any way to workaround this bug. Regards Mathieu Pujol Le 23/03/2015 11:46, Albe Laurenz a écrit : Pujol Mathieu wrote: I

[GENERAL] COPY command file name encoding issue (UTF8/WIN1252)

2015-03-23 Thread Pujol Mathieu
Hi, I have a problem using COPY command with a file name containing non ASCII characters. I use Postgres 9.3.5 x64 on a Windows 7. OS local encoding is WIN1252. My database is encoded in UTF8. I initiate client connection with libpq, connection encoding is set to UTF8. I build properly my file

Re: [GENERAL] How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Pujol Mathieu
Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some superclass table, e.g.: CREATE TABLE super ( super_id INT PRIMARY KEY, ... -- other columns ); CREATE TABLE sub_1 (

Re: [GENERAL] Re: How to implement a uniqueness constraint across multiple tables?

2014-08-01 Thread Pujol Mathieu
Le 01/08/2014 09:28, David G Johnston a écrit : Pujol Mathieu wrote Le 31/07/2014 20:38, Kynn Jones a écrit : I want to implement something akin to OO inheritance among DB tables. The idea is to define some superclass table, e.g.: (BTW, one could use PostgreSQL built-in support for table

Re: [GENERAL] How can I group all children by their parent ?

2014-07-17 Thread Pujol Mathieu
Le 17/07/2014 15:08, Arup Rakshit a écrit : How can I group all children by their parent ? id email parent_id 1 t...@test.com nil 2 te...@test.com 1 3 email 1 4 email 2 5 email nil 6 email 3 Regards, Arup Rakshit Did you mean SELECT array_agg(id), array_agg(email), parent_id FROM ... GROUP BY

Re: [GENERAL] conditional IF statements in postgresql

2014-07-08 Thread Pujol Mathieu
.. However, I get a error after running the program as: Adding col to table (ALTER) Failed: ERROR: syntax error at or near ELSE LINE 5: ELSE ^ Can you provide some suggestions. On Mon, Jul 7, 2014 at 10:46 AM, Pujol Mathieu

Re: [GENERAL] conditional IF statements in postgresql

2014-07-07 Thread Pujol Mathieu
Le 07/07/2014 12:48, Albe Laurenz a écrit : Madhurima Das wrote: I am writing a C program to access a PostgreSQL database, where I add a column if it doesn't exists in the table or, update the column, if the column already exits. Please suggest how to work with the conditional statements. N.B.

Re: [GENERAL] conditional IF statements in postgresql

2014-07-07 Thread Pujol Mathieu
Le 07/07/2014 13:44, Pujol Mathieu a écrit : Le 07/07/2014 12:48, Albe Laurenz a écrit : Madhurima Das wrote: I am writing a C program to access a PostgreSQL database, where I add a column if it doesn't exists in the table or, update the column, if the column already exits. Please suggest

Re: [GENERAL] converting a N rows table to a 1 row table ?

2014-07-03 Thread Pujol Mathieu
Le 03/07/2014 14:30, Arup Rakshit a écrit : Hi, One query is producing the below table :- answer | count | avg a1 3 14 a2 2 10 How to convert this to a single row table ? count | avg_a1 | avg_a2 5 14 10 Regards, Arup Rakshit Hi, Could you

[GENERAL] GIST optimization to limit calls to operator on sub nodes

2014-06-18 Thread Pujol Mathieu
Hello, My question is about GIST index. I made my own index to handle specific data and operators. It works pretty fine but I wonder if it was possible to optimize it. When I run my operator on a GIST node (in the method gist_range_consistent) it returns NotConsistent / MaybeConsistent /