Re: [GENERAL] accessing user table structures from SQL

2009-01-16 Thread Scott Marlowe
On Fri, Jan 16, 2009 at 9:32 PM, Vincent Predoehl wrote: > Does postgresql have a system table that has the table structure of user > tables, like systables and sysobjects in MS SQL Server? There's the pg_* views and tables that have all of that, and to see how they work, you can run psql -E and

[GENERAL] array_agg for 8.3

2009-01-16 Thread Faheem Mitha
Hi, Can anyone comment on the practicality of using the code for array_agg from the dev repos, file src/backend/utils/adt/array_userfuncs.c in 8.3 as a user defined function? It looks like this code was recently added, Nov 13th/14th. There are two functions, array_agg_transfn and array_agg_f

[GENERAL] executing a sql script

2009-01-16 Thread johnf
I'm using python and can execute standard "select,update,delete,functions". What I'd like to do is execute a sql script (a text file). But I don't know how? Some thing like: import psycopg2 import psycopg2.extensions conn = psycopg2.connect("host=%s dbname=%s user =%s password =%s "

[GENERAL] accessing user table structures from SQL

2009-01-16 Thread Vincent Predoehl
Does postgresql have a system table that has the table structure of user tables, like systables and sysobjects in MS SQL Server? -- Vincent

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Alvaro Herrera
Tom Lane wrote: > What is happening is that autovacuum_do_vac_analyze contains > > old_cxt = MemoryContextSwitchTo(AutovacMemCxt); > ... > vacuum(vacstmt, relids); > ... > MemoryContextSwitchTo(old_cxt); > > and at the time it is called by process_whole_db, CurrentM

Re: [GENERAL] Slave server: FATAL: incorrect checksum in control file

2009-01-16 Thread Leif Jensen
That is almost too simple ;-) Thanks for the suggestion, Leif - "Christopher Browne" wrote: > On Fri, Jan 16, 2009 at 9:18 PM, Leif Jensen > wrote: > > You are perfectly right, master is 32bit and slave is 64bit. I > didn't even consider that that would matter when "just" copying

Re: [GENERAL] Slave server: FATAL: incorrect checksum in control file

2009-01-16 Thread Christopher Browne
On Fri, Jan 16, 2009 at 9:18 PM, Leif Jensen wrote: > You are perfectly right, master is 32bit and slave is 64bit. I didn't even > consider that that would matter when "just" copying the data. First I was > using different versions on the two boxes, but ended up installing 8.3.5 on > both of t

Re: [GENERAL] Slave server: FATAL: incorrect checksum in control file

2009-01-16 Thread Leif Jensen
You are perfectly right, master is 32bit and slave is 64bit. I didn't even consider that that would matter when "just" copying the data. First I was using different versions on the two boxes, but ended up installing 8.3.5 on both of them. How do I install a 32bit PostgreSql on my 64bit (lin

[GENERAL] Trigger to clone across databases?

2009-01-16 Thread Darren Govoni
Hi, I'm looking for a trigger (any language) that can clone the inserted row and insert it in another postgres server elsewhere. Is this possible? Practical? Thoughts? I know there are some replication systems out there, but I'm hoping a simple trigger will suffice since I only need to clone one

[GENERAL] Usenet gateway not working

2009-01-16 Thread Rainer Bauer
Hello, seems like the usenet gateway is down again (my last successful contact to news.postgresql.org dates back 10 days). Is this a known problem? Rainer -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mail

Re: [GENERAL] Inheritance question

2009-01-16 Thread Erik Jones
On Jan 16, 2009, at 9:49 AM, Glyn Astill wrote: Hi chaps, I've got a question about inheritance here, and I think I may have gotten the wrong end of the stick as to how it works, or at least when to use it. What I intended to do was have a schema "audit" with an empty set of tables in

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Tom Lane
I wrote: > ... and you've seemingly not managed to install the debug symbols where > gdb can find them. But never mind that --- it turns out to be trivial to reproduce the crash. Just create a database, set its datfrozenxid and datvacuumxid far in the past (via a manual update of pg_database), en

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Justin Pasher
Tom Lane wrote: #1 0xb7c37811 in raise () from /lib/tls/i686/cmov/libc.so.6 #2 0xb7c38fb9 in abort () from /lib/tls/i686/cmov/libc.so.6 #3 0x0828cdf3 in ExceptionalCondition () #4 0x082a8cd2 in MemoryContextAlloc () #5 0x082a8d67 in MemoryContextStrdup () #6 0x0829749c in database_getflat

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Alvaro Herrera
Justin Pasher wrote: > Dang it. I wonder why the --enable-debug option doesn't seem to actually > be enabling debug. :( For reference, here is the configure command that > the package uses according to the config.log (in case you spot anything > wrong). Maybe the executable is getting strip

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Justin Pasher
Tom Lane wrote: Justin Pasher writes: I recompiled from the Debian source package and added --enable-cassert (--enable-debug was already there). I replaced the Debian standard packages with the recompiled versions and started up the cluster. Now it is hitting a failure on one of the assert

Re: [GENERAL] Slave server: FATAL: incorrect checksum in control file

2009-01-16 Thread Tom Lane
Leif Jensen writes: >So far I don't get any errors, but when I start postgres on the slave (I'm > using pg_ctl), I get the error 'FATAL: incorrect checksum in control file'. >Both servers are running PostgreSQL-8.3.5, configured with exactly the > same options (just prefix and ssl). M

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Tom Lane
Justin Pasher writes: > I recompiled from the Debian source package and added --enable-cassert > (--enable-debug was already there). I replaced the Debian standard > packages with the recompiled versions and started up the cluster. Now it > is hitting a failure on one of the assert lines, and t

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jason Long
David Wilson wrote: On Fri, Jan 16, 2009 at 3:27 PM, Jason Long wrote: I just tried it by sending text only instead of text and html. We will see if it goes through this time. Other than that do you see anything weird about my email? Still nothing. Do you have webspace you could pla

[GENERAL] Slave server: FATAL: incorrect checksum in control file

2009-01-16 Thread Leif Jensen
Hi Guys, I'm trying to set up a warm standby server, but have problems with running it on the backup. I feel that I have done like the documentation says: The WAL is being copied to the slave using rsync. Doing SELECT pg_start_backup(); (in psql) Copying the data directory to the

Re: [GENERAL] Autovacuum daemon terminated by signal 11

2009-01-16 Thread Justin Pasher
Tom Lane wrote: I read it like this: #0 0x0827441d in MemoryContextAlloc () <-- real #1 0x08274467 in MemoryContextStrdup ()<-- real #2 0x0826501c in database_getflatfilename () <-- real #3 0x0826504e in database_getflatfilename () <-- must be write_database_file #4 0x08

[GENERAL] Running queries to fetch a count of hits in DB on several things

2009-01-16 Thread Brendan Duddridge
You're not going to get anywhere using Postgres for this kind of task. Especially if you have millions of products like we do in our database. We switched to using Solr for our search indexing and querying. It's way faster than Postgres for obtaining counts like you need. We still fetch the

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread David Wilson
On Fri, Jan 16, 2009 at 3:27 PM, Jason Long wrote: > I just tried it by sending text only instead of text and html. We will see > if it goes through this time. > Other than that do you see anything weird about my email? Still nothing. Do you have webspace you could place it on? If not, you coul

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jason Long
Scott Marlowe wrote: On Thu, Jan 15, 2009 at 11:04 PM, Jeff Davis wrote: On Thu, 2009-01-15 at 19:37 -0600, Jason Long wrote: I have not looked into the detail of the explain, and I do see visually that very different plans are being chosen. It would help to share these pl

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jason Long
Scott Marlowe wrote: Weird. I wonder if the attachment is too big and the mailing list server is chopping it off of the email. I just tried it by sending text only instead of text and html. We will see if it goes through this time. Other than that do you see anything weird about my email?

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Scott Marlowe
Weird. I wonder if the attachment is too big and the mailing list server is chopping it off of the email. On Fri, Jan 16, 2009 at 1:19 PM, Jason Long wrote: > Scott Marlowe wrote: > > On Thu, Jan 15, 2009 at 11:04 PM, Jeff Davis wrote: > > > On Thu, 2009-01-15 at 19:37 -0600, Jason Long wrote:

Re: [GENERAL] Questions regarding indexes

2009-01-16 Thread Tom Lane
"Scott Marlowe" writes: > The order doesn't matter. Analyze doesn't know anything about the > indexes, it knows about the fields / tables. I.e. if you run analyze, > then create the index, you get the same basic result as if you create > the index then run analyze. There is an exception to that

Re: [GENERAL] Questions regarding indexes

2009-01-16 Thread Scott Marlowe
On Fri, Jan 16, 2009 at 8:47 AM, Bruno Lavoie wrote: > Hello, > > are these statements true: Got interrupted by a coworker... The other two questions: > «Create an index if you frequently want to retrieve less than about ~15% of > the rows in a large table» PostgreSQL tends to switch to seq sc

Re: [GENERAL] Questions regarding indexes

2009-01-16 Thread Scott Marlowe
On Fri, Jan 16, 2009 at 8:47 AM, Bruno Lavoie wrote: > Hello, > > are these statements true: > > «You should always index fks. The only exception is when the matching unique > or primary key is never updated or deleted» ? No. If the table that fks to another table has 10 rows and will never have

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Scott Marlowe
On Thu, Jan 15, 2009 at 11:04 PM, Jeff Davis wrote: > On Thu, 2009-01-15 at 19:37 -0600, Jason Long wrote: >> > >> > > I have not looked into the detail of the explain, and I do see visually >> > > that very different plans are being chosen. >> > > >> > >> > It would help to share these plans with

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jeff Davis
On Fri, 2009-01-16 at 13:37 -0500, Martin Gainty wrote: > good idea although tweaks to geqo_pool_size, geqo_generations, and > geqo_selection_bias will affect all queries Only queries that invoke GEQO. Regards, Jeff Davis -- Sent via pgsql-general mailing list (pgsql-general@postgresql

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jeff Davis
On Fri, 2009-01-16 at 12:35 -0600, Jason Long wrote: > The schema is not auto generated. It evolved as I created my > inventory system. > It is relatively easy for humans to understand. Or at least for me > since I wrote it. On second look, there aren't that many tables. There are just a lot o

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jason Long
Jeff Davis wrote: On Fri, 2009-01-16 at 08:43 -0600, Jason Long wrote: The numbers in the table names are due to hibernate generating the query. Well, that's what auto-generated schemas and queries do, I guess. The schema is not auto generated. It evolved as I created my inventor

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Martin Gainty
good idea although tweaks to geqo_pool_size, geqo_generations, and geqo_selection_bias will affect all queries For larger and unwieldy queries you might want to look at breaking the queries down to smaller pieces e.g. Break each statement to 2 tables with 1 join (preferrably inner join with US

Re: [GENERAL] Query sometimes takes down server

2009-01-16 Thread Jeff Davis
On Fri, 2009-01-16 at 08:43 -0600, Jason Long wrote: > The numbers in the table names are due to hibernate generating the > query. Well, that's what auto-generated schemas and queries do, I guess. > Now we are getting somewhere. > Someone suggested tweaking the genetic algorithm parameters. > H

Re: [HACKERS] [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread Tom Lane
David Fetter writes: > Basically, there is no way I've found so far to qualify any window > function in the target list, which makes a giant POLA violation. The FM points out in at least two places that window functions logically execute on the output of the WHERE/GROUP BY/HAVING steps. It's co

Re: [HACKERS] [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread David Fetter
On Fri, Jan 16, 2009 at 12:41:59PM -0500, Tom Lane wrote: > David Fetter writes: > > We don't appear to be able to use the actual thing in the target list > > either. > > Would you translate that into English? Or at least an example without > trivial syntax errors? This works: SELECT typ,

[GENERAL] Inheritance question

2009-01-16 Thread Glyn Astill
Hi chaps, I've got a question about inheritance here, and I think I may have gotten the wrong end of the stick as to how it works, or at least when to use it. What I intended to do was have a schema "audit" with an empty set of tables in it, then each quarter restore our audit data into schemas

Re: [HACKERS] [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread Tom Lane
David Fetter writes: > We don't appear to be able to use the actual thing in the target list > either. Would you translate that into English? Or at least an example without trivial syntax errors? regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@p

[GENERAL] Running queries to fetch a count of hits in DB on several things

2009-01-16 Thread Mohamed
Hi, this is basically what I would like to improve : 1) A user searches for a product on category and location. a) The query is run and the result (limit 30) are returned and shown. b) The same query is ran again but now I return the count on how many matches there was totally. (This has to be pos

Re: [HACKERS] [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread David Fetter
On Fri, Jan 16, 2009 at 12:34:34PM -0500, Tom Lane wrote: > David Fetter writes: > > I tried this: > > > SELECT > > typ, > > ts, > > rank() over w AS foo_rank > > FROM > > foo > > WINDOW w AS (partition by typ order by ts desc) > > WHERE > > foo_rank < 4; > > > ERROR

Re: [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread Tom Lane
David Fetter writes: > I tried this: > SELECT > typ, > ts, > rank() over w AS foo_rank > FROM > foo > WINDOW w AS (partition by typ order by ts desc) > WHERE > foo_rank < 4; > ERROR: syntax error at or near "WHERE" > LINE 8: WHERE > ^ RTFM ... WINDOW goes a

Re: [HACKERS] Re: [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread David Fetter
On Fri, Jan 16, 2009 at 12:23:16PM -0500, Jaime Casanova wrote: > On Fri, Jan 16, 2009 at 12:07 PM, David Fetter wrote: > >> > >> Now i want only 3 records for every typ: > >> > >> test=# select typ, ts, rank() over (partition by typ order by ts desc ) > >> from foo where rank <= 3; > >> ERROR:

Re: [HACKERS] Re: [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread Jaime Casanova
On Fri, Jan 16, 2009 at 12:07 PM, David Fetter wrote: >> >> Now i want only 3 records for every typ: >> >> test=# select typ, ts, rank() over (partition by typ order by ts desc ) >> from foo where rank <= 3; >> ERROR: column "rank" does not exist >> LINE 1: ...rtition by typ order by ts desc )

Re: [GENERAL] Question regarding new windowing functions in 8.4devel

2009-01-16 Thread David Fetter
On Thu, Jan 15, 2009 at 03:06:47PM +0100, A. Kretschmer wrote: > Hi, > > first, many thanks to all for the great work, i'm waiting for 8.4. > > > I have played with the new possibilities: > > test=# select typ, ts, rank() over (partition by typ order by ts desc ) from > foo; > typ |

[GENERAL] Questions regarding indexes

2009-01-16 Thread Bruno Lavoie
Hello, are these statements true: * «You should always index fks. The only exception is when the matching unique or primary key is never updated or deleted» ? * «Small tables do not require indexes» ? * «Create an index if you frequently want to retrieve less than about ~15% o

Re: [GENERAL] Diff tool for two schema

2009-01-16 Thread Bruno Lavoie
you can also look at: http://www.sqlmanager.net/en/products/postgresql/dbcomparer Not free but it's a nice product, with nice support give it a try. You can also check at other products from EMS, very nice! Especially the SQL Manager: http://www.sqlmanager.net/en/products/postgresql/manager

Re: [GENERAL] Diff tool for two schema

2009-01-16 Thread Grzegorz Jaśkiewicz
dbwrench has this option, afair - called 'reverse synchronize'. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Diff tool for two schema

2009-01-16 Thread Glyn Astill
Anyone know of a decent diff tool for comparing two schemas? I Had a go with http://apgdiff.sourceforge.net/ but it appears it doesn't quote it's sql properly. A shame, otherwise it'd be just what I need. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make change

Re: [GENERAL] Question regarding Postgres + OpenSSL + FIPs

2009-01-16 Thread Magnus Hagander
Dhaval Shah wrote: > I am setting up Postgres for OpenSSL + FIPs. > > I am compiling Postgres with OpenSSL FIPS library using the > "-with-openssl" option. The question I have is, just doing that > suffice? Or do I have to modify the postgres source code? > > Since I read through the OpenSSL FIP