[GENERAL] Optimize the query, help me please.

2011-11-23 Thread Капралов Александр
Query is: SELECT * FROM a UNION SELECT * FROM b ORDER BY time DESC LIMIT 100 how can i get only last 100 row from a and b and then do union. Explain of select said that all recond selected from a and b. thanks.

Re: [GENERAL] Optimize the query, help me please.

2011-11-23 Thread Raymond O'Donnell
On 23/11/2011 10:56, Капралов Александр wrote: > Query is: > SELECT * FROM a UNION SELECT * FROM b ORDER BY time DESC LIMIT 100 > > how can i get only last 100 row from a and b and then do union. Explain > of select said that all recond selected from a and b. (select * from a order by time desc

Re: [GENERAL] Optimize the query, help me please.

2011-11-23 Thread Bèrto ëd Sèra
Hi, (SELECT * FROM a limit 10) union (SELECT * FROM b limit 10) is what you need Bèrto 2011/11/23 Капралов Александр > Query is: > SELECT * FROM a UNION SELECT * FROM b ORDER BY time DESC LIMIT 100 > > how can i get only last 100 row from a and b and then do union. Explain of > select said t

Re: [GENERAL] Optimize the query, help me please.

2011-11-23 Thread Achilleas Mantzios
Στις Wednesday 23 November 2011 12:56:23 ο/η Капралов Александр έγραψε: > Query is: > SELECT * FROM a UNION SELECT * FROM b ORDER BY time DESC LIMIT 100 > > how can i get only last 100 row from a and b and then do union. Explain of > select said that all recond selected from a and b. > In order

[GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Raghavendra
Respected All, Today on my local box, I observed crash and when I started Instance my beginning line of new pg_log's look like this. 2011-11-23 17:18:14 IST [2958]: [1-1] LOG: database system was interrupted; last known up at *2011-11-23 00:45:43 IST* 2011-11-23 17:18:14 IST [2958]: [2-1] LO

[GENERAL] Пользователь Капралов Александр хочет пообщаться с вами

2011-11-23 Thread Капралов Александр
--- Пользователь Капралов Александр хочет общаться с Вами, используя новейшие продукты Google. Если у Вас уже установлен Gmail или Google Talk, перейдите на страницу http://mail.google.com/mail/b-f536b5aea-955d3fea97-i7pB5IcEv3GSX

[GENERAL] Пользователь Капралов Александр хочет пообщаться с вами

2011-11-23 Thread Капралов Александр
--- Пользователь Капралов Александр хочет общаться с Вами, используя новейшие продукты Google. Если у Вас уже установлен Gmail или Google Talk, перейдите на страницу http://mail.google.com/mail/b-f536b5aea-9238018186--lZdHgynL2Qd2

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Raghavendra
On Wed, Nov 23, 2011 at 7:35 PM, Raghavendra < raghavendra@enterprisedb.com> wrote: > Respected All, > > Today on my local box, I observed crash and when I started Instance my > beginning line of new pg_log's look like this. > > 2011-11-23 17:18:14 IST [2958]: [1-1] LOG: database system was

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Alex Shulgin
On Wed, Nov 23, 2011 at 16:59, Raghavendra wrote: > > Just to clear my question, am looking for this  "last known up at 2011-11-23 > 00:45:43 IST" line information recorded in any pg_catalogs ? How would it read that from a catalog if the cluster didn't recover from the crash yet? I'd think it's

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Raghavendra
On Wed, Nov 23, 2011 at 8:35 PM, Alex Shulgin wrote: > On Wed, Nov 23, 2011 at 16:59, Raghavendra > wrote: > > > > Just to clear my question, am looking for this "last known up > at 2011-11-23 > > 00:45:43 IST" line information recorded in any pg_catalogs ? > > How would it read that from a cata

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Tom Lane
Alex Shulgin writes: > How would it read that from a catalog if the cluster didn't recover > from the crash yet? > I'd think it's looking at last-modified timestamps of some of the > PGDATA files instead. No, it's looking at a last-update timestamp field in pg_control. r

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Raghavendra
On Wed, Nov 23, 2011 at 9:01 PM, Tom Lane wrote: > Alex Shulgin writes: > > How would it read that from a catalog if the cluster didn't recover > > from the crash yet? > > > I'd think it's looking at last-modified timestamps of some of the > > PGDATA files instead. > > No, it's looking at a last

[GENERAL] pg_dump of a v8.3.4 -> v9.0.1

2011-11-23 Thread Gauthier, Dave
Hi: I have a pg_dump pf a v8.3.4 DB that I would like to bring into a v9.0.1 PG instance. What is the best way to do this? Note, the dump file is too big to fit into an editor, but I could sed it if need be. Thanks.

Re: [GENERAL] pg_dump of a v8.3.4 -> v9.0.1

2011-11-23 Thread Adrian Klaver
On 11/23/2011 08:08 AM, Gauthier, Dave wrote: Hi: I have a pg_dump pf a v8.3.4 DB that I would like to bring into a v9.0.1 PG instance. What is the best way to do this? Note, the dump file is too big to fit into an editor, but I could sed it if need be. Did you do the data dump using the 8.3.4

Re: [GENERAL] pg_dump of a v8.3.4 -> v9.0.1

2011-11-23 Thread Gauthier, Dave
I used pg_dump v 8.3.4, but I could rerun using v9.0.1. I was thinking that pg_dump v9 would refuse to play right with the v8 DB. Is that a false assumption? -Original Message- From: Adrian Klaver [mailto:adrian.kla...@gmail.com] Sent: Wednesday, November 23, 2011 11:48 AM To: Gauth

Re: [GENERAL] pg_dump of a v8.3.4 -> v9.0.1

2011-11-23 Thread Adrian Klaver
On 11/23/2011 08:50 AM, Gauthier, Dave wrote: I used pg_dump v 8.3.4, but I could rerun using v9.0.1. I was thinking that pg_dump v9 would refuse to play right with the v8 DB. Is that a false assumption? Yes. http://www.postgresql.org/docs/9.0/interactive/app-pgdump.html "Because pg_dump

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Tom Lane
Raghavendra writes: > On Wed, Nov 23, 2011 at 9:01 PM, Tom Lane wrote: >> No, it's looking at a last-update timestamp field in pg_control. > So, Is it a approximate time of crash on the basis of last-modified > timestamp of pg_control file ? IIRC, that's going to be the time of last checkpoint

Re: [GENERAL] In which catalog postgres Instance Crash time recorded ?

2011-11-23 Thread Raghavendra
On Wed, Nov 23, 2011 at 10:27 PM, Tom Lane wrote: > Raghavendra writes: > > On Wed, Nov 23, 2011 at 9:01 PM, Tom Lane wrote: > >> No, it's looking at a last-update timestamp field in pg_control. > > > So, Is it a approximate time of crash on the basis of last-modified > > timestamp of pg_contro

[GENERAL] Blank Numeric Column For INSERT

2011-11-23 Thread Rich Shepard
I am trying to load 143K rows into a postgres-9.0.5 table from an ASCII text file. The file consists of INSERT INTO ... statements and the VALUES are comma delimited. One column is numeric (REAL), but ~10K rows have that value missing, and postgres rejects the lines. The column does not have

[GENERAL] On naming attributes in a WITH clause

2011-11-23 Thread AM
Hello, Is it possible to rename columns in a WITH clause which includes VALUES? None of the following parse: WITH map_table AS ( VALUES ('1','r'),('2','w'),('3','a'),('4','d') ) AS (a,b) SELECT * FROM map_table; WITH map_table AS ( VALUES ('1','r'),('2','w'),('3','a'),('4','d') AS t (a

Re: [GENERAL] On naming attributes in a WITH clause

2011-11-23 Thread David Johnston
It is described in the "SELECT" documentation "WITH" section but is somewhat obscure; just add the column names, in (), after the WITH name. WITH name (col1, col2, col3) AS ( SELECT 1, 2, 3 ) David J. -Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-gener

Re: [GENERAL] Blank Numeric Column For INSERT

2011-11-23 Thread Richard Broersma
On Wed, Nov 23, 2011 at 10:33 AM, Rich Shepard wrote: >  Originally I had two commas in sequence since there were no values between > them. Next I tried a space between the two commas. I tried searching in the > 9.0.5 manual for 'missing values', 'missing', and another term I don't > recall but f

Re: [GENERAL] Blank Numeric Column For INSERT

2011-11-23 Thread Rich Shepard
On Wed, 23 Nov 2011, Richard Broersma wrote: My pg.dump files show nulls as: \N Richard, Mine do, too. But, that's not what postgres wants to see in the .sql file. It takes it as a newline (\n) whether quoted or not. Thanks, Rich -- Sent via pgsql-general mailing list (pgsql-general@post

Re: [GENERAL] Blank Numeric Column For INSERT

2011-11-23 Thread Tom Lane
Rich Shepard writes: >Mine do, too. But, that's not what postgres wants to see in the .sql file. In an insert command, you need to either write NULL or omit the column from the column list; empty expressions aren't syntactically correct. (Note that the latter option actually results in insert

[GENERAL] PGError: ERROR: could not open relation with OID?

2011-11-23 Thread Jay Levitt
Running Postgresql 9.0.5 on Ubuntu 10.10, we just saw: PGError: ERROR: could not open relation with OID 39008 SELECT questions.*, r.relevance as score, r.explanation as explanation FROM "questions" INNER JOIN "users" ON "users"."id" = "questions"."user_id" JOIN relevance(13218) AS r ON question

Re: [GENERAL] Blank Numeric Column For INSERT

2011-11-23 Thread Rich Shepard
On Wed, 23 Nov 2011, Tom Lane wrote: In an insert command, you need to either write NULL or omit the column from the column list; empty expressions aren't syntactically correct. (Note that the latter option actually results in inserting the column's default, not necessarily null...) Tom, I

[GENERAL] Compiler does not detect support for 64 bit integers

2011-11-23 Thread Antonio Franzoso
I'm trying to compile a parser for full text searching starting from the code in this example: http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/HOWTO-parser-tsearch2.html I'm using Code::block with MinGW on a Windows Seven x64 and I get these errors: ..\..\..\Program Files\PostgreSQ

[GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Chris McDonald
Hi, I am upgrading a system from postgresql 8.4.8 (fedora 13 x64) to postgresql 9.0.5 (fedora 15 x64). As I build a database I've noticed that the following works on 8.4.8 but does not work on 9.0.5. Can someone tell me why this is not legal syntax in 9.0.5 but is legal in 8.4.8 please: ===snip

Re: [GENERAL] pg_standby for postgresql8.2

2011-11-23 Thread khizer
Hi Robert, Thanks for ur views, I got an advice from a DB professional Raghavendra Rao as below it worked From your contrib/pg_standby location you need to first set the path for pg_config and do ./configure or directly make, make install. This will create pg_standby executable in pos

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Pavel Stehule
Hello http://developer.postgresql.org/pgdocs/postgres/release-9-0.html PL/pgSQL no longer allows variable names that match certain reserved words (Tom Lane) use double quotes rec."open" = 32; Regards Pavel Stehule 2011/11/23 Chris McDonald : > Hi, > I am upgrading a system from postgresql

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Jerry Sievers
Chris McDonald writes: > Hi, I am upgrading a system from postgresql 8.4.8 (fedora 13 x64) to > postgresql 9.0.5 (fedora 15 x64). As I build a database I've noticed > that the following works on 8.4.8 but does not work on 9.0.5. Can > someone tell me why this is not legal syntax in 9.0.5 but is l

Re: [GENERAL] Compiler does not detect support for 64 bit integers

2011-11-23 Thread Tom Lane
Antonio Franzoso writes: > I'm using Code::block with MinGW on a Windows Seven x64 and I get these > errors: > ..\..\..\Program Files\PostgreSQL\9.0\include\server\c.h|284|error: > #error must have a working 64-bit integer datatype| Um ... did you run the configure script? In a MinGW environm

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Jerry Sievers
Chris McDonald writes: > Hi, I am upgrading a system from postgresql 8.4.8 (fedora 13 x64) to > postgresql 9.0.5 (fedora 15 x64). As I build a database I've noticed > that the following works on 8.4.8 but does not work on 9.0.5. Can > someone tell me why this is not legal syntax in 9.0.5 but is l

[GENERAL] Permission Problems

2011-11-23 Thread Bill Thoen
I'm trying to put together a very simple web application to display information about any table in my database that a web user wants to see. The general idea is to present a list of schemata and their associated tables to the user who then picks one, which causes the server to send the list of

Re: [GENERAL] Permission Problems

2011-11-23 Thread Joshua D. Drake
On 11/23/2011 01:54 PM, Bill Thoen wrote: Am I digging too deep here, or what am I missing? Is there a better way to tranfer info between my database and the web than by using a generic account? It sure seems like I'm granting too much access to too little a player. Any advice would be welcome.

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Tom Lane
Jerry Sievers writes: > Hmmm, I do not see that open is a reserved word but the PL must be > treating it special somehow. plpgsql has a different list of reserved words than the main SQL grammar does. I don't think we explicitly document it anywhere, but pretty much any keyword that can start a

Re: [GENERAL] Permission Problems

2011-11-23 Thread Sven Schoradt
Am 23.11.2011 22:54, schrieb Bill Thoen: > I'm getting the list of schemata from the information_schema.schemata > table, and using my superuser account it works fine. However, using the > account I've set up for this job isn't getting very far and I'm getting > nothing returned. I've granted permi

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Chris McDonald
OK, I see it is the term open which fails the syntax checker - I guessed this might be because open is a reserved word but http://www.postgresql.org/docs/9.0/interactive/sql-keywords-appendix.html does not indicate whether open is either reserved or not in postgresql. Checking 8.4 doco, http:/

Re: [GENERAL] Installed. Now what?

2011-11-23 Thread Phoenix Kiula
On Tue, Nov 22, 2011 at 2:13 AM, Steve Crawford wrote: > .. > The information in the pgbouncer pseudo-database is helpful, here (psql -U > youradminuser -h 127.0.0.1 pgbouncer). Thanks, I finally got it connecting. Where's the "pgbouncer" database. Do I need to install it? It's not install

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Adrian Klaver
On Wednesday, November 23, 2011 11:43:04 am Chris McDonald wrote: > OK, I see it is the term open which fails the syntax checker - I guessed > this might be because open is a reserved word but > http://www.postgresql.org/docs/9.0/interactive/sql-keywords-appendix.html > does not indicate whether op

Re: [GENERAL] Installed. Now what?

2011-11-23 Thread Phoenix Kiula
On Thu, Nov 24, 2011 at 9:18 AM, Phoenix Kiula wrote: > On Tue, Nov 22, 2011 at 2:13 AM, Steve Crawford ... > Thanks, I finally got it connecting. Where's the "pgbouncer" database. Do I need to install it? It's not installed. (How else should I tell the load and utilization?) Also, how can I

Re: [GENERAL] Installed. Now what?

2011-11-23 Thread Adrian Klaver
On Wednesday, November 23, 2011 5:31:10 pm Phoenix Kiula wrote: > On Thu, Nov 24, 2011 at 9:18 AM, Phoenix Kiula wrote: > > On Tue, Nov 22, 2011 at 2:13 AM, Steve Crawford > > ... > > > > Thanks, I finally got it connecting. > > Where's the "pgbouncer" database. Do I need to install it? It's

Re: [GENERAL] plpgsql Difference in behaviour between versions?

2011-11-23 Thread Tom Lane
Chris McDonald writes: > Still interested in a definitive answer, but the fix for me appears to be > simply to change the word open to something else. Well, if you want a definitive answer, you can consult the list of plpgsql reserved words here: http://git.postgresql.org/gitweb/?p=postgresql.gi