[GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-07-31 Thread David G Johnston
Adam Mackler-5 wrote (Cross-posted to StackOverflow: http://stackoverflow.com/questions/25041100/postgresql-user-defined-operator-function-what-parameter-type-to-use-for-uncast ) I'm defining my own domain and a equality operator. Next I create an equality operator to do case-insensitive

Re: [GENERAL] pgbouncer not finding pidfile

2014-07-31 Thread Tobias Fielitz
I have played around with it a bit more, it seems adding the pre-start section works: pre-start script if [ -d /var/run/postgresql ]; then chmod 2775 /var/run/postgresql else install -d -m 2775 -o postgres -g postgres /var/run/postgresql fi end script Thanks Adrian!

Re: [GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-07-31 Thread Adam Mackler
On Wed, Jul 30, 2014 at 10:59:28PM -0700, David G Johnston wrote: ISTM that if this was supported you would be doing it correctly. Thank you for the quick response. I'm not understanding you. Could you elaborate? The main problem is you are abusing DOMAIN - which is strictly the base

[GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-07-31 Thread David G Johnston
On Thu, Jul 31, 2014 at 12:19 AM, Adam Mackler-5 [via PostgreSQL] ml-node+s1045698n5813399...@n5.nabble.com wrote: On Wed, Jul 30, 2014 at 10:59:28PM -0700, David G Johnston wrote: ISTM that if this was supported you would be doing it correctly. Thank you for the quick response. I'm not

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Emir Ibrahimbegovic
Thank you for your response guys. On Wed, Jul 30, 2014 at 9:25 PM, Chris Curvey ch...@chriscurvey.com wrote: On Wed, Jul 30, 2014 at 8:41 PM, Emir Ibrahimbegovic emir.ibrahimbego...@gmail.com wrote: Hello all, I've got two queries which should produce the same results but they don't

Re: [GENERAL] BDR Postgres

2014-07-31 Thread Adrian Klaver
On 07/30/2014 10:25 PM, Tonny wrote: Hi everyone I read that 2ndQuadrant released bidirectional replication for postgres, know whether this package will enter apt.postgresql.org or if there will be any repository for Debian GNU / Linux? Information is here:

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Adrian Klaver
On 07/31/2014 05:44 AM, Emir Ibrahimbegovic wrote: Thank you for your response guys. So, did you find the cause? -- Adrian Klaver adrian.kla...@aklaver.com -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Emir Ibrahimbegovic
Yes there was some users subscribed at different date than payment was made. So I used this to get the results on the daily basis : SELECT date_trunc('day', payments.created_at) day, SUM(payments.amount) AS sum_id FROM payments INNER JOIN users ON users.id = payments.user_id WHERE

Re: [GENERAL] Inconsistent results postgresql

2014-07-31 Thread Kevin Grittner
Chris Curvey ch...@chriscurvey.com wrote: Emir Ibrahimbegovic emir.ibrahimbego...@gmail.com wrote: So looking for same date using different date range I get different results, how is this even possible? Can I look at something else? I'm really stuck here Remove the sum (just select

Re: [GENERAL] String concatenation operator which keeps trailing spaces in CHAR(n) columns

2014-07-31 Thread Merlin Moncure
On Wed, Jul 30, 2014 at 5:43 AM, Andrus kobrule...@hot.ee wrote: How to create string concatenation operator which preserves trailing spaces on CHAR(n) type columns ? hm, why do that at all? how about avoid the char() type and create views over tables using rpad when you want space padding:

Re: [GENERAL] What query currently running within function

2014-07-31 Thread Merlin Moncure
On Tue, Jul 22, 2014 at 4:36 AM, Rebecca Clarke r.clark...@gmail.com wrote: Hi all, Presently I'm executing a function that runs many queries within it. select * from _myfunction(); Is there a way to see what query it is up to within the function? When I do a select of pg_stat_activity it

Re: [GENERAL] String concatenation operator which keeps trailing spaces in CHAR(n) columns

2014-07-31 Thread Andrus
Hi, hm, why do that at all? how about avoid the char() type and create views over tables using rpad when you want space padding: create view v_foo as select *, rpad(f, 50, ' ') as f_padded; I'm creating a converter which converts Visual FoxPro expressions to Postgres at runtime. FoxPro

Re: [GENERAL] User-defined operator function: what parameter type to use for uncast character string?

2014-07-31 Thread Kevin Grittner
Adam Mackler pgsql-gene...@mackler.org wrote: CREATE domain my_domain as char(3) check(VALUE similar to '[A-C]{3}'); CREATE TABLE my_table (val my_domain); INSERT INTO my_table VALUES ('ABC'); sandbox= SELECT * FROM my_table WHERE val='abc'; val - (0 rows)

Re: [GENERAL] Re: User-defined operator function: what parameter type to use for uncast character string?

2014-07-31 Thread Tom Lane
David G Johnston david.g.johns...@gmail.com writes: On Thu, Jul 31, 2014 at 12:19 AM, Adam Mackler-5 [via PostgreSQL] ml-node+s1045698n5813399...@n5.nabble.com wrote: Can you explain what the abuse is? Also why the = operator does not work even without the domain? When you write,

Re: [GENERAL] Postgress Doubts

2014-07-31 Thread Bruce Momjian
On Fri, Jun 6, 2014 at 04:29:59PM +0530, Atri Sharma wrote: On Fri, Jun 6, 2014 at 4:22 PM, Ravi Kiran ravi.kolanp...@gmail.com wrote: Hello, I am Ravikiran, pursuing my third year BITS Pilani, India, I am doing my thesis in postgress technology, The project is about

Re: [GENERAL] How can I create null value from function call with no results?

2014-07-31 Thread Marc Mamin
I want to call a function using a column of a table as the parameter and return the parameter and function results together. The problem is, when the function returns an empty row my select statement that uses the function returns an empty row as well. Hello, not sure if it makes sense in

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

2014-07-31 Thread Kynn Jones
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 ( super_id INT PRIMARY KEY,

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

2014-07-31 Thread Marti Raudsepp
On Thu, Jul 31, 2014 at 9:38 PM, Kynn Jones kyn...@gmail.com wrote: Does PostgreSQL have a good way to enforce the uniqueness of super_id values across multiple tables? Well that's easy: no. Regards, Marti -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes

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

2014-07-31 Thread Rob Sargent
On 07/31/2014 12:38 PM, Kynn Jones wrote: 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] How to implement a uniqueness constraint across multiple tables?

2014-07-31 Thread Rob Sargent
On 07/31/2014 01:16 PM, Marti Raudsepp wrote: On Thu, Jul 31, 2014 at 9:38 PM, Kynn Jones kyn...@gmail.com wrote: Does PostgreSQL have a good way to enforce the uniqueness of super_id values across multiple tables? Well that's easy: no. Regards, Marti That might be a little hasty. There

[GENERAL] Is it possible to create an index without keeping the indexed data in a column?

2014-07-31 Thread Larry White
Hi, I would like to create a GIN index on a set of JSON documents. Right now I'm storing the data in a JSONB column. The current index looks like this: CREATE INDEX document_payload_idx ON document USING gin (payload jsonb_path_ops); The index is pretty small, but the actual data takes up

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

2014-07-31 Thread Kevin Grittner
Kynn Jones kyn...@gmail.com wrote: 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 (   

[GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-07-31 Thread Larry White
Hi, I'm running an experiment on 9.4 beta 2. I put 275,000 identical JSON files into a table using JSONB (one per row). Each raw text file is 251K in size, so the total uncompressed is 69GB. The column storage is set to EXTENDED. There are other toastable columns in the table, but none have

Re: [GENERAL] Is it possible to create an index without keeping the indexed data in a column?

2014-07-31 Thread Michael Paquier
On Fri, Aug 1, 2014 at 4:47 AM, Larry White ljw1...@gmail.com wrote: Is there a way to get Postgres to index the table as if the JSON were there, but not actually put the data in the table? I could either store the docs elsewhere and keep a reference, or compress them and put them in the table

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-07-31 Thread Adrian Klaver
On 07/31/2014 01:44 PM, Larry White wrote: Hi, I'm running an experiment on 9.4 beta 2. I put 275,000 identical JSON files into a table using JSONB (one per row). Each raw text file is 251K in size, so the total uncompressed is 69GB. The column storage is set to EXTENDED. There are other

Re: [GENERAL] Very Limited Toast Compression on JSONB (9.4 beta 2)

2014-07-31 Thread Larry White
Yes. It was EXTENDED. As a further test, I dropped the table and rebuilt it, explicitly changing the EXTENDED designation to EXTERNAL and got exactly the same size TOAST table. So there was no compression at all with storage set to EXTENDED. On Thu, Jul 31, 2014 at 11:51 PM, Adrian Klaver

Re: [GENERAL] Is it possible to create an index without keeping the indexed data in a column?

2014-07-31 Thread Amit Langote
On Fri, Aug 1, 2014 at 10:48 AM, Michael Paquier michael.paqu...@gmail.com wrote: On Fri, Aug 1, 2014 at 4:47 AM, Larry White ljw1...@gmail.com wrote: Is there a way to get Postgres to index the table as if the JSON were there, but not actually put the data in the table? I could either store