Re: [GENERAL] Defining functions for arrays of any number type

2014-12-10 Thread Tom Lane
Paul Jungwirth writes: > Is it legal to define a bunch of functions all called `array_to_hist` > for the different numeric types, and have them all implemented by the > same C function? Sure. (There is a regression test that objects if we try to do that with built-in functions, but it's meant to

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Melvin Davidson
I suggest you download and install PgAdmin. http://www.pgadmin.org/index.php It makes review of functions and other database objects, as well as maintenance, a lot easier. Otherwise, you can just use psql eg: psql \o /some_dir/your_proc_filename \sf+ \q Your function definition will now be i

[GENERAL] Defining functions for arrays of any number type

2014-12-10 Thread Paul Jungwirth
Hello, I'm working on a package of functions that compute statistics on arrays of numbers. For example this one computes a histogram from a bunch of values plus some bucket characteristics: CREATE OR REPLACE FUNCTION array_to_hist(double precision[], double precision, double precision, int) RETUR

Re: [GENERAL] I did some testing of GIST/GIN vs BTree indexing…

2014-12-10 Thread Bruce Momjian
On Wed, Dec 10, 2014 at 05:27:16PM -0800, Guyren Howe wrote: > >> Given the futility of database benchmarking in general, I didn’t > >> want to go any further with this. What I was interested in was > >> whether it might be worth switching from BTree to GIST/GIN indexes > >> with regular sorts of d

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Paul Jungwirth
How do you handle DDL changes in general? I would treat stored procedures the same way. For instance Ruby on Rails has "database migrations" where you write one method to apply the DDL change and another to revert it, like this: def up add_column :employees, :manager_id, :integer a

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Adrian Klaver
On 12/10/2014 05:03 PM, Gavin Flower wrote: On 11/12/14 13:53, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my "DB Commands" text file - Copy and paste function into my d

[GENERAL] Re: [GENERAL] I did some testing of GIST/GIN vs BTree indexing…

2014-12-10 Thread Guyren Howe
On Dec 6, 2014, at 12:38 , Bruce Momjian wrote: > > On Wed, Dec 3, 2014 at 01:15:50AM -0800, Guyren Howe wrote: >> GIN is certainly not the “three times” size suggested in the docs, but >> perhaps >> that just hasn’t been updated for the 9.4 improvements. Certainly, there >> isn’t >> sufficien

Re: service allowing arbitrary relations was Re: [GENERAL] hstore, but with fast range comparisons?

2014-12-10 Thread Guyren Howe
>> I want to do something that is perfectly satisfied by an hstore column. >> *Except* that I want to be able to do fast (ie indexed) <, > etc >> comparisons, not just equality. >> >> From what I can tell, there isn’t really any way to get hstore to do this, >> so I’ll have to go to a key-val

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Rob Sargent
On 12/10/2014 05:53 PM, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my "DB Commands" text file - Copy and paste function into my development database - Test - repeat abo

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Adrian Klaver
On 12/10/2014 04:53 PM, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my "DB Commands" text file - Copy and paste function into my development database - Test - repeat abov

Re: [GENERAL] Stored procedure workflow question

2014-12-10 Thread Gavin Flower
On 11/12/14 13:53, Israel Brewster wrote: Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following: - Create/edit the desired function in my "DB Commands" text file - Copy and paste function into my development database - Test - repeat above un

[GENERAL] Stored procedure workflow question

2014-12-10 Thread Israel Brewster
Currently, when I need to create/edit a stored procedure in Postgresql, my workflow goes like the following:- Create/edit the desired function in my "DB Commands" text file- Copy and paste function into my development database- Test- repeat above until it works as desired- Copy and paste function i

Re: [GENERAL] Integrating C++ singletons into postgresql extensions???

2014-12-10 Thread vicky
Tom Lane-2 wrote > FWIW, if you are using the logging collector (highly recommended), output > to a backend process's stdout or stderr will be caught and included in the > log, though it won't have a log_line_prefix. This might be a usable > substitute for adapting your code. > >

Re: [GENERAL] ALTER TYPE ADD SEND AND RECEIVE

2014-12-10 Thread Tom Lane
Manuel Kniep writes: > I have a custom type and want to add the yet missing  SEND and RECEIVE > functions > is there anyway to alter the type definition without dropping and recreating > it? There's no supported way to do that. As an unsupported way, you could consider a manual UPDATE on the

Re: [GENERAL] new index type with clustering in mind.

2014-12-10 Thread Alvaro Herrera
Jack Douglas wrote: > > If the values are perfectly clustered, the index is optimal because you > scan the minimal set of pages. > > That's the bit I'm particularly interested in, as my plan would be to keep > the pages well clustered: http://dba.stackexchange.com/a/66293/1396 > > Do you see any

[GENERAL] ALTER TYPE ADD SEND AND RECEIVE

2014-12-10 Thread Manuel Kniep
I have a custom type and want to add the yet missing  SEND and RECEIVE functions is there anyway to alter the type definition without dropping and recreating it? Manuel

Re: [GENERAL] Speeding up an in-progress wraparound-preventing vacuum

2014-12-10 Thread Jeff Janes
On Mon, Dec 8, 2014 at 4:58 PM, Vincent de Phily < vincent.deph...@mobile-devices.fr> wrote: > On Monday 08 December 2014 10:17:37 Jeff Janes wrote: > > On Mon, Dec 8, 2014 at 4:54 AM, Vincent de Phily < > > > I don't think that routine vacuums even attempts to update relfrozenxid, > or > > at lea

Re: [GENERAL] new index type with clustering in mind.

2014-12-10 Thread Jack Douglas
> If the values are perfectly clustered, the index is optimal because you scan the minimal set of pages. That's the bit I'm particularly interested in, as my plan would be to keep the pages well clustered: http://dba.stackexchange.com/a/66293/1396 Do you see any blocker preventing BRIN being used

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
On 12/10/2014 02:34 PM, Adrian Klaver wrote: On 12/10/2014 10:08 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 01:00 PM, Adrian Klaver wrote: On 12/10/2014 09:54 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 12:47 PM, Adrian Klaver wrote: On 12/10/2014 09:25 AM, Gabriel Sánchez Mar

Re: [GENERAL] new index type with clustering in mind.

2014-12-10 Thread Alvaro Herrera
Jack Douglas wrote: > > in 9.4, GIN indexes are pretty close to this already > > Do I understand correctly that BRIN indexes will be even closer to this? > Yeah, in a way. You could say they are closer from the opposite end. There is one index tuple in a BRIN index for each page range (contiguo

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Adrian Klaver
On 12/10/2014 10:08 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 01:00 PM, Adrian Klaver wrote: On 12/10/2014 09:54 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 12:47 PM, Adrian Klaver wrote: On 12/10/2014 09:25 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:49 AM, Adrian K

Re: [GENERAL] Use cases for lateral that do not involve a set returning function

2014-12-10 Thread Merlin Moncure
On Tue, Dec 9, 2014 at 4:24 AM, Albe Laurenz wrote: > SELECT ... > FROM people p > LEFT JOIN LATERAL (SELECT * FROM names n > WHERE n.people_id = p.people_id > AND current_timestamp > n.validfrom > ORDER BY n.validfrom DE

Re: [GENERAL] new index type with clustering in mind.

2014-12-10 Thread Jack Douglas
> in 9.4, GIN indexes are pretty close to this already Do I understand correctly that BRIN indexes will be even closer to this? Kindest regards Jack -Original Message- From: Tom Lane [mailto:t...@sss.pgh.pa.us] Sent: 24 May 2014 22:46 To: Martijn van Oosterhout Cc: Jack Douglas; pgsql-g

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
On 12/10/2014 01:48 PM, Tomas Vondra wrote: On 10.12.2014 17:07, Gabriel Sánchez Martínez wrote: Hi all, I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB of RAM. When running pg_dump on a specific table, I get the following error: pg_dump: Dumping the contents of table

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Tomas Vondra
On 10.12.2014 17:07, Gabriel Sánchez Martínez wrote: > Hi all, > > I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB > of RAM. When running pg_dump on a specific table, I get the following > error: > > pg_dump: Dumping the contents of table "x_2013" failed: > PQgetResult

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
On 12/10/2014 01:00 PM, Adrian Klaver wrote: On 12/10/2014 09:54 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 12:47 PM, Adrian Klaver wrote: On 12/10/2014 09:25 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:49 AM, Adrian Klaver wrote: On 12/10/2014 08:31 AM, Gabriel Sánchez Mar

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Adrian Klaver
On 12/10/2014 09:54 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 12:47 PM, Adrian Klaver wrote: On 12/10/2014 09:25 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:49 AM, Adrian Klaver wrote: On 12/10/2014 08:31 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:16 AM, Adrian K

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
On 12/10/2014 12:47 PM, Adrian Klaver wrote: On 12/10/2014 09:25 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:49 AM, Adrian Klaver wrote: On 12/10/2014 08:31 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:16 AM, Adrian Klaver wrote: On 12/10/2014 08:07 AM, Gabriel Sánchez Mar

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Adrian Klaver
On 12/10/2014 09:25 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:49 AM, Adrian Klaver wrote: On 12/10/2014 08:31 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:16 AM, Adrian Klaver wrote: On 12/10/2014 08:07 AM, Gabriel Sánchez Martínez wrote: Hi all, I am running PostgreSQL

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
On 12/10/2014 11:49 AM, Adrian Klaver wrote: On 12/10/2014 08:31 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:16 AM, Adrian Klaver wrote: On 12/10/2014 08:07 AM, Gabriel Sánchez Martínez wrote: Hi all, I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB of RAM. W

Re: [GENERAL] Current log files when rotating?

2014-12-10 Thread Alex Shulgin
Sam Mason writes: > On Mon, Nov 10, 2008 at 02:30:41PM -0800, Steve Atkins wrote: >> On Nov 10, 2008, at 1:35 PM, Tom Lane wrote: >> >Alvaro Herrera writes: >> >>It seems that there is enough need for this feature, that it has been >> >>implemented multiple times -- but most of them will fail i

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Adrian Klaver
On 12/10/2014 08:31 AM, Gabriel Sánchez Martínez wrote: On 12/10/2014 11:16 AM, Adrian Klaver wrote: On 12/10/2014 08:07 AM, Gabriel Sánchez Martínez wrote: Hi all, I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB of RAM. When running pg_dump on a specific table, I get

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
On 12/10/2014 11:16 AM, Adrian Klaver wrote: On 12/10/2014 08:07 AM, Gabriel Sánchez Martínez wrote: Hi all, I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB of RAM. When running pg_dump on a specific table, I get the following error: pg_dump: Dumping the contents of ta

Re: [GENERAL] invalid memory alloc request size

2014-12-10 Thread Adrian Klaver
On 12/10/2014 08:07 AM, Gabriel Sánchez Martínez wrote: Hi all, I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB of RAM. When running pg_dump on a specific table, I get the following error: pg_dump: Dumping the contents of table "x_2013" failed: PQgetResult() failed.

Re: [GENERAL] Error : Ensure this value has at most 30 characters (it has 31) django

2014-12-10 Thread Adrian Klaver
CCing list. On 12/10/2014 08:06 AM, VENKTESH GUTTEDAR wrote: Ya i used python manage.py syncdb Well, per Davids suggestion, you might want to check that it is indeed the email field that is triggering the validation error. Both the first_name and last_name fields in auth_user have a field l

[GENERAL] invalid memory alloc request size

2014-12-10 Thread Gabriel Sánchez Martínez
Hi all, I am running PostgreSQL 9.3.5 on Ubuntu Server 14.04 64 bit with 64 GB of RAM. When running pg_dump on a specific table, I get the following error: pg_dump: Dumping the contents of table "x_2013" failed: PQgetResult() failed. pg_dump: Error message from server: ERROR: invalid m

Re: Fwd: Fwd: [GENERAL] Problem with pg_dump and decimal mark

2014-12-10 Thread Eric Svenson
> The restore left you with two empty tables. What happens if you log into Postgres > via psql and then INSERT one set of values containing floats into say, >dev_my_settings? SUCCESS! This works OK! INSERT INTO dev_my_settings(123, 'test', 'test', 'test', 123, 123.345); Value 123.345 can be read

Re: Fwd: Fwd: [GENERAL] Problem with pg_dump and decimal mark

2014-12-10 Thread Eric Svenson
So, one more success... I have taken a part of the backup SQL file which fills the table COPY dev_my_settings (.) from stdin; 12345 text text 0 123.345345 This file ALONE works! (without changing ANYTHING!) So if I run the first (huge) SQL file and then the second, which fills the de

[GENERAL] Help Optimizing a Summary Query

2014-12-10 Thread Robert DiFalco
I have users, friends, and friend_requests. I need a query that essentially returns a summary containing: * user (name, imageURL, bio, ...) * Friend status (relative to an active user) * Is the user a friend of the active user? * Has the user sent a friend request to the acti

[GENERAL] List of shorthand casts

2014-12-10 Thread FarjadFarid(ChkNet)
Is the list of shorthand casts documented somewhere? If so can you please direct me to it. A working URL would be great. Thank you. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Idle Sessions inTransaction with RELEASE_EXEC_SVP queries and locks

2014-12-10 Thread Adrian Klaver
On 12/08/2014 02:05 AM, chris.jur...@primesoft.ph wrote: ​I am having a problem with having idle sessions in transactions. In pgAdmin Server Status, it is showing "RELEASE_EXEC_SVP_XX" (XX data are varied) as its query and it's locks also contain a lot of these "RELEASE_EXEC_SVP_XX" e

Re: Fwd: Fwd: [GENERAL] Problem with pg_dump and decimal mark

2014-12-10 Thread Adrian Klaver
On 12/10/2014 01:32 AM, Eric Svenson wrote: So, one more success... I have taken a part of the backup SQL file which fills the table COPY dev_my_settings (.) from stdin; 12345 text text 0 123.345345 This file ALONE works! (without changing ANYTHING!) Hmm, almost like the encoding/

Re: [GENERAL] Error : Ensure this value has at most 30 characters (it has 31) django

2014-12-10 Thread Adrian Klaver
On 12/10/2014 04:38 AM, VENKTESH GUTTEDAR wrote: Hello, I am using DJango 1.7 and Postgresql 9.3.5. I am trying to store email in the username field of django.contrib.auth.models.User. but when i try to store more than 30 characters i am getting this error : Ensure this value has

[GENERAL] Re: Error : Ensure this value has at most 30 characters (it has 31) django

2014-12-10 Thread David G Johnston
VENKTESH GUTTEDAR wrote > Hello, > > I am using DJango 1.7 and Postgresql 9.3.5. > > I am trying to store email in the username field of > django.contrib.auth.models.User. > but when i try to store more than 30 characters i am getting this > error > : Ensure this value has at most 30

[GENERAL] Error : Ensure this value has at most 30 characters (it has 31) django

2014-12-10 Thread VENKTESH GUTTEDAR
Hello, I am using DJango 1.7 and Postgresql 9.3.5. I am trying to store email in the username field of django.contrib.auth.models.User. but when i try to store more than 30 characters i am getting this error : Ensure this value has at most 30 characters (it has 31) django i tried