Re: [GENERAL] Expression to construct a anonymous record with named columns?

2012-09-20 Thread Alban Hertroys
On 20 Sep 2012, at 20:36, Benedikt Grundmann wrote: > So named anonymous records / row types seem to be strangely second class. > Can somebody clarify the restrictions and rationale or even better show a way > to do the equivalent of (made up syntax ahead): > > select row(1 as a, 2 as b); sel

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Chris Angelico
On Fri, Sep 21, 2012 at 2:39 PM, John R Pierce wrote: > On 09/20/12 10:27 AM, Alan Millington wrote: >> >> I am using Notepad, which inserts the byte order mark. Following the links >> a bit further, I gather that the version of Notepad that I am using may not >> identify a UTF8 file correctly if

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread John R Pierce
On 09/20/12 10:27 AM, Alan Millington wrote: I am using Notepad, which inserts the byte order mark. Following the links a bit further, I gather that the version of Notepad that I am using may not identify a UTF8 file correctly if the byte order mark is omitted. Also, as I mentioned, Python make

Re: [GENERAL] foreign key from array element

2012-09-20 Thread Chris Travers
On Thu, Sep 20, 2012 at 12:18 AM, Gabriele Bartolini < gabriele.bartol...@2ndquadrant.it> wrote: > Hi Chris, > >thank you very much for taking the time to read the article and get > into the features proposed with our patch. You are welcome. Also in case there is ambiguity, the feature I wa

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Alan Millington
Thank you for the link. I am using Notepad, which inserts the byte order mark. Following the links a bit further, I gather that the version of Notepad that I am using may not identify a UTF8 file correctly if the byte order mark is omitted. Also, as I mentioned, Python makes use of it. (From the

[GENERAL] Expression to construct a anonymous record with named columns?

2012-09-20 Thread Benedikt Grundmann
Hello, Is there a way to construct write an expression that constructs a record with with named columns. Specificially without the need for a corresponding named type. That is postgres=# select row(1, 2, 3); row - (1,2,3) (1 row) Creates a unnamed record type. And indeed it is for

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Chris Angelico
On Fri, Sep 21, 2012 at 11:21 AM, Craig Ringer wrote: > I strongly disagree. The BOM provides a useful and standard way to > differentiate UTF-8 encoded text files from the random pile of encodings > that any given file could be. The only reliable way to ascertain the encoding of a hunk of data i

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Craig Ringer
On 09/20/2012 11:44 PM, Leif Biberg Kristensen wrote: Torsdag 20. september 2012 16.56.16 skrev Alan Millington : psql". But how am I supposed to remove the byte order mark from a UTF8 file? I thought that the whole point of the byte order mark was to tell programs what the file encoding is. O

Re: [GENERAL] Why do I have holes in my pages?

2012-09-20 Thread Aleksey Tsalolikhin
On Thu, Sep 20, 2012 at 1:53 PM, John R Pierce wrote: > On 09/20/12 1:34 PM, Aleksey Tsalolikhin wrote: >> >> Right on. I got that out of my pgstatspack report. >> >> \l+ in psql tells me the same thing - 400 GB > > > it might be interesting to see the output of... > > du -hs $PGDATA/* Well,

Re: [GENERAL] Why do I have holes in my pages?

2012-09-20 Thread John R Pierce
On 09/20/12 1:34 PM, Aleksey Tsalolikhin wrote: Right on. I got that out of my pgstatspack report. \l+ in psql tells me the same thing - 400 GB it might be interesting to see the output of... du -hs $PGDATA/* (assuming this is a linux or similar unix system). This will show how mu

Re: [GENERAL] Why do I have holes in my pages?

2012-09-20 Thread Victor Yegorov
Take a look at this part of the documentation: http://www.postgresql.org/docs/current/interactive/routine-vacuuming.html#VACUUM-FOR-SPACE-RECOVERY The “missing” entries belong to the tuples that you have DELETEd/UPDATEd and that are no longer visible to your current session, but still might be for

Re: [GENERAL] Why do I have holes in my pages?

2012-09-20 Thread Aleksey Tsalolikhin
On Thu, Sep 20, 2012 at 12:34 PM, Bill Moran wrote: > In response to Aleksey Tsalolikhin : >> >> Current DB size is 400 GB and it takes up 2.7 TB (on a 6.6 TB filesystem). > > I expect that the first thing that others are going to ask > is "what is telling you that your DB is 400G?" Right on. I

Re: [GENERAL] Why do I have holes in my pages?

2012-09-20 Thread Bill Moran
In response to Aleksey Tsalolikhin : > > Current DB size is 400 GB and it takes up 2.7 TB (on a 6.6 TB filesystem). I expect that the first thing that others are going to ask is "what is telling you that your DB is 400G?" -- Bill Moran http://www.potentialtech.com http://people.collaborativefus

[GENERAL] Why do I have holes in my pages?

2012-09-20 Thread Aleksey Tsalolikhin
Why do I have holes in my pages? Postgres 8.4.12 "select ctid from big_table" on my master shows that pages have "holes" in them. Here is example for page 431665: (431665,2) (431665,5) (431665,8) (431665,11) (431665,14) (431665,17) (431665,20) (431665,23) Current DB size is 400 GB and

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread John R Pierce
On 09/20/12 7:56 AM, Alan Millington wrote: I discovered a long time ago that psql does not like UTF8 files: it complains about the byte order mark on the first line. in case it wasn't clear from previous replies, Windows native Unicode format is NOT UTF8, its UTF16, where every character is s

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Leif Biberg Kristensen
Torsdag 20. september 2012 16.56.16 skrev Alan Millington : > psql". But how am I supposed to remove the byte order mark from a UTF8 > file? I thought that the whole point of the byte order mark was to tell > programs what the file encoding is. Other programs, such as Python, rely > on this. http

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Adrian Klaver
On 09/20/2012 10:44 AM, Leif Biberg Kristensen wrote: Torsdag 20. september 2012 19.27.22 skrev Alan Millington : Thank you for the link. I am using Notepad, which inserts the byte order mark. Following the links a bit further, I gather that the version of Notepad that I am using may not ident

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Leif Biberg Kristensen
Torsdag 20. september 2012 19.27.22 skrev Alan Millington : > Thank you for the link. I am using Notepad, which inserts the byte order > mark. Following the links a bit further, I gather that the version of > Notepad that I am using may not identify a UTF8 file correctly if the byte > order mark i

Re: [GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Tom Lane
Alan Millington writes: > I am running Postgres 8.4.1 on Windows XP Professional Service Pack 3. My > database is UTF8. I use psql -f to load files containing DDL and DML > commands. I discovered a long time ago that psql does not like UTF8 files: it > complains about the byte order mark on the

Re: [GENERAL] Passing row set into PL/pgSQL function.

2012-09-20 Thread Lucas Clemente Vella
> http://www.depesz.com/2012/06/10/why-is-upsert-so-complicated/ I have already seen this page, I am OK in running SERIALIZABLE transactions, and have no problem in replaying failed transactions due to race condition. Anyway, that is completely off my issue: I need upsert and I am prepared to deal

[GENERAL] Using psql -f to load a UTF8 file

2012-09-20 Thread Alan Millington
I am running Postgres 8.4.1 on Windows XP Professional Service Pack 3. My database is UTF8. I use psql -f to load files containing DDL and DML commands. I discovered a long time ago that psql does not like UTF8 files: it complains about the byte order mark on the first line. Up to now I have wor

Re: [GENERAL] Passing row set into PL/pgSQL function.

2012-09-20 Thread Merlin Moncure
On Wed, Sep 19, 2012 at 4:37 PM, Lucas Clemente Vella wrote: > I am trying to write a generic "upsert" function in PL/pgSQL, in a way > that I can specify the table were I want to insert/update, the columns > whose values I want to specify, and the values to be inserted. > > So far I have come up

[GENERAL] WITH RECURSIVE from 2 or more tables.

2012-09-20 Thread Капралов Александр
Hello. I have 2 tables: CREATE TABLE "group" ( id serial NOT NULL "name" character varying(23) NOT NULL id_user integer NOT NULL DEFAULT 0, parent integer DEFAULT 0, CONSTRAINT group_user_fkey FOREIGN KEY (id_user) REFERENCES "user" (id) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE,

Re: [GENERAL] pg_upgrade: out of memory

2012-09-20 Thread Tom Lane
"Carrington, Matthew (Produban)" writes: > I have attempted to upgrade my Postgres installation this morning from 9.0.1 > to 9.2.0 and it failed with an out of memory problem using pg_dumpall to dump > the first database. Hm. I'm not aware of any reason for 9.2 pg_dump to take hugely more memo

Re: [GENERAL] Need psql send email

2012-09-20 Thread Chris Travers
Hi all; A couple points here. First, you probably don't want to send email directly from a database function. This gives significant problems for which there is no good solution. Consider: 1) You sent your email and now the transaction rolls back. You *cannot* roll back the sent email. 2)

Re: [GENERAL] Need psql send email

2012-09-20 Thread Edson Richter
Em 20/09/2012 09:07, pavithra escreveu: Hi All, I am new to postgresql. I want to send email by using pl pgsql. I want to know how to set up the configurations for mail server. Can any one help me in solving this?. [hidden email] ---

Re: [GENERAL] Need psql send email

2012-09-20 Thread Martin French
> The 1st one seems OK in a scary-from-a-security-standpoint kind of way. Agree, it needs to be weighed up and assessed from a security stand point I guess. > The 2nd, not so much. See >http://stackoverflow.com/questions/12002662/psql-trigger-send-email > > Imagine if the DNS goes wonky.

Re: [GENERAL] Slow counting still true?

2012-09-20 Thread Edson Richter
Em 18/09/2012 15:24, Jeff Janes escreveu: On Mon, Sep 17, 2012 at 9:14 AM, Edson Richter wrote: The wiki page in question has been updated today, and I see the alert in top of page "Note that the following article only applies to versions of PostgreSQL prior to 9.2. Index-only scans are now im

Re: [GENERAL] Need psql send email

2012-09-20 Thread Martin Gainty
many is the time when spammers have used Open Relay SMTP servers to send their junk mail so i would advise against using sendmail on Open Relay SMTP servers I would narrow access by SSH or open a secure tunnel thru your firewall to your own internal DatabaseManagementSystem/J2EEServer/ApacheHTTP

Re: [GENERAL] Need psql send email

2012-09-20 Thread Craig Ringer
On 09/20/2012 08:40 PM, Martin French wrote: Both of these work fine provided PL/PerlU is installed and the server is properly configured on the network, and that there is a valid SMTP mail host to receive. The 1st one seems OK in a scary-from-a-security-standpoint kind of way. The 2nd, not s

Re: [GENERAL] RFE: Column aliases in WHERE clauses

2012-09-20 Thread David Johnston
> > On Wed, Sep 19, 2012 at 11:15 PM, David Johnston > wrote: > > I could maybe see something like the following having some value: > > > > SELECT inverse > > FROM data > > WHERE x<>0 AND inverse > .5 > > MACRO inverse (1/x) > > > > WITH macros AS (SELECT *,1/x AS inverse FROM data) SELECT inver

Re: [GENERAL] Passing row set into PL/pgSQL function.

2012-09-20 Thread Craig Ringer
On 09/20/2012 01:47 PM, Lucas Clemente Vella wrote: http://www.depesz.com/2012/06/10/why-is-upsert-so-complicated/ I have already seen this page, I am OK in running SERIALIZABLE transactions, and have no problem in replaying failed transactions due to race condition. Anyway, that is completely

Re: [GENERAL] Need psql send email

2012-09-20 Thread Martin French
> > Hi All,I am new to postgresql. I want to send email by using pl > pgsql. I want > > to know how to set up the configurations for mail server.Can any one help me > > in solving this?. pavithra@gmail.com > > http://www.depesz.com/2012/06/13/how-to-send-mail-from-database/ > > Best regards

Re: [GENERAL] Need psql send email

2012-09-20 Thread pavithra
I am more wondered where we need to give the port address and smtpserver. Can you give me the details of these?. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Need-psql-send-email-tp5724700p5724705.html Sent from the PostgreSQL - general mailing list archive at Nabbl

Re: [GENERAL] Need psql send email

2012-09-20 Thread hubert depesz lubaczewski
On Thu, Sep 20, 2012 at 05:07:18AM -0700, pavithra wrote: > Hi All,I am new to postgresql. I want to send email by using pl pgsql. I want > to know how to set up the configurations for mail server.Can any one help me > in solving this?. pavithra@gmail.com http://www.depesz.com/2012/06/13/how-t

Re: [GENERAL] Need psql send email

2012-09-20 Thread Raymond O'Donnell
On 20/09/2012 13:07, pavithra wrote: > Hi All, I am new to postgresql. I want to send email by using pl pgsql. > I want to know how to set up the configurations for mail server. Can any > one help me in solving this?. [hidden email] Hi there, It's not possible to send email directly from pl/pgsql

Re: [GENERAL] Need psql send email

2012-09-20 Thread Victor Yegorov
Check this article: http://www.depesz.com/2012/06/13/how-to-send-mail-from-database/ 2012/9/20 pavithra > Hi All, I am new to postgresql. I want to send email by using pl pgsql. I > want to know how to set up the configurations for mail server. Can any one > help me in solving this?. [hidden >

[GENERAL] Need psql send email

2012-09-20 Thread pavithra
Hi All,I am new to postgresql. I want to send email by using pl pgsql. I want to know how to set up the configurations for mail server.Can any one help me in solving this?. pavithra@gmail.com -- View this message in context: http://postgresql.1045698.n5.nabble.com/Need-psql-send-email-tp572

Re: [GENERAL] should I increase default_statistics_target

2012-09-20 Thread Ondrej Ivanič
Hi, On 20 September 2012 20:49, AI Rumman wrote: > Using explain analyze of a large query I found that in every step there are > a lot difference between the number of rows between actual and estimated. > I am using default_statistics_target 200. Should I increase it? I would keep it at default

[GENERAL] should I increase default_statistics_target

2012-09-20 Thread AI Rumman
Using explain analyze of a large query I found that in every step there are a lot difference between the number of rows between actual and estimated. I am using default_statistics_target 200. Should I increase it?

Re: [GENERAL] application for postgres Log

2012-09-20 Thread Arvind Singh
thanx Laurenz, But Our CSV Log contains lot of statements like the following THREE lines. They appear exactly one after the other. And they number in thousands for a Session (more than ten thousand) 2011-11-11 12:41:31.484 IST,"agent1","pem",524,"localhost:2141",4ebccaa2.20c,754,"idle"

Re: [GENERAL] foreign key from array element

2012-09-20 Thread Gabriele Bartolini
Hi Chris, thank you very much for taking the time to read the article and get into the features proposed with our patch. On Tue, 18 Sep 2012 17:17:56 -0700, Chris Travers wrote: So those are the cautions and why I don't think a feature like this is suitable for routine usage, but truth b