[GENERAL] Web + Slicing/Paging datas

2009-04-23 Thread durumdara
Hi! In a mod_py application I wanna write a wrapper that handle all PSQL data view with paging/slicing. For example: I have 1.500 records. I wanna show only N (f. ex: 15) records in the view, other records are accessable with a pager (links): [First, P-2, P-1, P, P+1 P+2, Last] F. Ex:

Re: [GENERAL] Web + Slicing/Paging datas

2009-04-23 Thread John R Pierce
durumdara wrote: Hi! In a mod_py application I wanna write a wrapper that handle all PSQL data view with paging/slicing. .. Inserts all records to a temp table. Check the affected rows (as count). Slicing the records. Fetch the slice records. Destroy temp table. how about KEEPING the data

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Seref Arikan
Hi Scott, I agree, and I am doing the entity attribute model because I simply have to. This table is used to persist data that is hold in user defined information models. Kind of a domain specific language. The users continously create these hierarchical structures, so neither the amount of them,

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Filip Rembiałkowski
W dniu 22 kwietnia 2009 23:47 użytkownik Seref Arikan serefari...@kurumsalteknoloji.com napisał: Hi Filip, First of all: thanks a lot for your kind response. Here is the create script for my schema: CREATE TABLE app.archetype_data ( id BIGINT NOT NULL, context_id VARCHAR(1000),

[GENERAL] pg_lsclusters error after pg_dropcluster

2009-04-23 Thread Willy-Bas Loos
On debian lenny, upgraded from etch, after stopping and dropping a cluster with (pg_ctlcluster 8.1 name stop + pg_dropcluster 8.1 name, no errors), the cluster still appears in the pg_lsclusters and i get the error: Use of uninitialized value $info{owneruid} in getpwuid at /usr/bin/pg_lsclusters

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Wed, Apr 22, 2009 at 06:21:41PM -0600, Scott Marlowe wrote: CREATE TABLE app.archetype_data (   id BIGINT NOT NULL,   context_id VARCHAR(1000),   archetype_name VARCHAR(1000),   archetype_path VARCHAR(1000),   name VARCHAR(1000),   value_string VARCHAR(1000),   value_int

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Thu, Apr 23, 2009 at 09:44:53AM +0100, Seref Arikan wrote: I have worked with very capable DBAs before, and even though it has been quite some time since I've done real DB work, I would like to invest in postgresql as much as I can Seref, if you can muster the man power to build archetypes

[GENERAL] varchar vs. text + constraint/triggers was: Help request to improve function performance

2009-04-23 Thread Ivan Sergio Borgonovo
On Thu, 23 Apr 2009 11:00:59 +0200 Karsten Hilbert karsten.hilb...@gmx.net wrote: On Thu, Apr 23, 2009 at 12:02:13AM +0100, Seref Arikan wrote: I have a set of dynamically composed objects represented in Java, with string values for various attributes, which have variable length. In case

Re: [GENERAL] varchar vs. text + constraint/triggers was: Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Thu, Apr 23, 2009 at 11:33:34AM +0200, Ivan Sergio Borgonovo wrote: Karsten Hilbert karsten.hilb...@gmx.net wrote: On Thu, Apr 23, 2009 at 12:02:13AM +0100, Seref Arikan wrote: I have a set of dynamically composed objects represented in Java, with string values for various

Re: [GENERAL] Web + Slicing/Paging datas

2009-04-23 Thread durumdara
Hi! 2009.04.23. 9:23 keltezéssel, John R Pierce írta: durumdara wrote: Hi! In a mod_py application I wanna write a wrapper that handle all PSQL data view with paging/slicing. .. Inserts all records to a temp table. Check the affected rows (as count). Slicing the records. Fetch the slice

Re: [GENERAL] Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Thu, Apr 23, 2009 at 12:02:13AM +0100, Seref Arikan wrote: I have a set of dynamically composed objects represented in Java, with string values for various attributes, which have variable length. In case you have suggestions for a better type for this case, it would be my pleasure to hear

Re: [GENERAL] varchar vs. text + constraint/triggers was: Help request to improve function performance

2009-04-23 Thread Ivan Sergio Borgonovo
On Thu, 23 Apr 2009 12:00:30 +0200 Karsten Hilbert karsten.hilb...@gmx.net wrote: On Thu, Apr 23, 2009 at 11:33:34AM +0200, Ivan Sergio Borgonovo wrote: Karsten Hilbert karsten.hilb...@gmx.net wrote: On Thu, Apr 23, 2009 at 12:02:13AM +0100, Seref Arikan wrote: I have a set of

Re: [GENERAL] varchar vs. text + constraint/triggers was: Help request to improve function performance

2009-04-23 Thread Grzegorz Jaśkiewicz
essentially you are trying to store a database in a database, and that's slow for one. Second, storing things as varchar is space and index (space) ineffective - and that's another reason to make things slower. Third - you need to complicate your logic to retrieve data, and that adds up. text is

[GENERAL] need help for PostgreSQL consistency check mechanism

2009-04-23 Thread Chen, Dongdong (GE Healthcare)
We are now working on database check mechanism in our application. The situation is when server shutdown abnormally, the postmaster.pid file still exists when reboot, But the PostgreSQL database itself may not be damaged. We just do not want to restore from backups when the database is still good

Re: [GENERAL] pg_lsclusters error after pg_dropcluster

2009-04-23 Thread Alvaro Herrera
Willy-Bas Loos escribió: On debian lenny, upgraded from etch, after stopping and dropping a cluster with (pg_ctlcluster 8.1 name stop + pg_dropcluster 8.1 name, no errors), the cluster still appears in the pg_lsclusters and i get the error: Use of uninitialized value $info{owneruid} in

Re: [GENERAL] varchar vs. text + constraint/triggers was: Help request to improve function performance

2009-04-23 Thread Karsten Hilbert
On Thu, Apr 23, 2009 at 01:21:05PM +0200, Ivan Sergio Borgonovo wrote: I'll try to rephrase to check if I understood and for reference. varchar is slower than text since it has to do some data type check. Yes but no. It is said to be slower because it has to do a data length check, not a

Re: [GENERAL] Dynamic SQL in Function

2009-04-23 Thread rwade
Is this possible without having to pass in the _ref parameter? Thanks Ryan On Wed, Apr 22, 2009 at 12:29 PM, rw...@uci.edu wrote: If I have built a dynamic sql statement in a function, how do i return it as a ref cursor? CREATE FUNCTION reffunc(_ref) RETURNS refcursor AS $$ BEGIN

[GENERAL] recover corrupt DB?

2009-04-23 Thread Dan Armbrust
I had a test system (read as not backed up, sigh) which had the disk go full while PostgreSQL was loaded, consequently, PostgreSQL will no longer start. It is logging an error about detecting an invalid shutdown, trying to replay something, and then an error about not being able to open a file it

Re: [GENERAL] pg_lsclusters error after pg_dropcluster

2009-04-23 Thread Willy-Bas Loos
ok, i did. Bug#525294: postgresql-common: pg_lsclusters error after pg_dropcluster On Thu, Apr 23, 2009 at 3:29 PM, Alvaro Herrera alvhe...@commandprompt.comwrote: Willy-Bas Loos escribió: On debian lenny, upgraded from etch, after stopping and dropping a cluster with (pg_ctlcluster 8.1

Re: [GENERAL] recover corrupt DB?

2009-04-23 Thread Peter Eisentraut
On Thursday 23 April 2009 18:30:27 Dan Armbrust wrote: I had a test system (read as not backed up, sigh) which had the disk go full while PostgreSQL was loaded, consequently, PostgreSQL will no longer start. It is logging an error about detecting an invalid shutdown, trying to replay

Re: [GENERAL] how to search for relation by name?

2009-04-23 Thread zach cruise
Thanks! I just created new database using old database as template, and everything got copied over without errors. is that recommended over pg_dump though when just recreating database for different encoding? http://www.postgresql.org/docs/8.1/interactive/manage-ag-templatedbs.html On Wed, Apr

Re: [GENERAL] recover corrupt DB?

2009-04-23 Thread Dan Armbrust
 In general, pg_resetxlog would be the tool to try here.  Don't panic yet. ;-) Yep, that was the command I was looking for. That at least got the DB to a point where it would start, and I was able to do a dump. So, I dumped and reloaded all of the databases. Things seem fine, but bits and

Re: [GENERAL] recover corrupt DB?

2009-04-23 Thread Milos Babic
Yes. Some things like duplicate primary key can exist in pg_resetxlog-ed db. So, dump db and restore it again on clean initialized cluster. Regards Milos On Thu, Apr 23, 2009 at 8:25 PM, Dan Armbrust daniel.armbrust.l...@gmail.com wrote: In general, pg_resetxlog would be the tool to try

[GENERAL] utf8 encoding for template0 and template1?

2009-04-23 Thread zach cruise
is it recommended to change encodings for template0 and template1 to utf8 (by recreating databases) for 8.1? -- 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] how to search for relation by name?

2009-04-23 Thread Tom Lane
zach cruise zachc1...@gmail.com writes: Thanks! I just created new database using old database as template, and everything got copied over without errors. is that recommended over pg_dump though when just recreating database for different encoding? It's pretty much guaranteed not to work,

Re: [GENERAL] Dynamic SQL in Function

2009-04-23 Thread Merlin Moncure
On Thu, Apr 23, 2009 at 11:36 AM, rw...@uci.edu wrote: On Wed, Apr 22, 2009 at 12:29 PM,  rw...@uci.edu wrote: If I have built a dynamic sql statement in a function, how do i return it as a ref cursor? CREATE FUNCTION reffunc(_ref) RETURNS refcursor AS $$ BEGIN     OPEN _ref FOR execute

[GENERAL] standard_conforming_strings and pg_escape_string()

2009-04-23 Thread Conrad Lender
Hi. I'm using PostgreSQL 8.3 with PHP's pgsql module (libpq 8.3.7). When the server's standard_conforming_strings setting is off (this is currently still the default, I believe), I use something like this to escape strings: if ($escWildcards) { $str = strtr($str, array(% = '\%', _ =

[GENERAL] OperationalError: FATAL: could not open file filename: Too many open files in system

2009-04-23 Thread Ben Welsh
Hello, I'm managing a pgsql-django-mod_python-apache machine that serves no media, but handles postgres, memcached and apache all by itself. Recently I've begun drawing too many open files in the system errors, as seen in the subject line. Browsing the postgres documentation, I suspect that I

Re: [GENERAL] utf8 encoding for template0 and template1?

2009-04-23 Thread Peter Eisentraut
On Thursday 23 April 2009 20:33:56 zach cruise wrote: is it recommended to change encodings for template0 and template1 to utf8 (by recreating databases) for 8.1? Not if you don't have a specific reason for doing so. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] Dynamic SQL in Function

2009-04-23 Thread Martin Gainty
_ Rediscover Hotmail®: Get e-mail storage that grows with you. http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Storage2_042009 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make

Re: [GENERAL] standard_conforming_strings and pg_escape_string()

2009-04-23 Thread Tom Lane
Conrad Lender crlen...@gmail.com writes: I'm using PostgreSQL 8.3 with PHP's pgsql module (libpq 8.3.7). When the server's standard_conforming_strings setting is off (this is currently still the default, I believe), I use something like this to escape strings: if ($escWildcards) {

[GENERAL]

2009-04-23 Thread Adam Ruth
-- 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] standard_conforming_strings and pg_escape_string()

2009-04-23 Thread Conrad Lender
Tom, thanks for your reply. On 24/04/09 00:56, Tom Lane wrote: if ($escWildcards) { $str = strtr($str, array(% = '\%', _ = '\_')); } return E' . pg_escape_string($str) . '; The above cannot possibly work. pg_escape_string is generating what it supposes to be a normal string

Re: [GENERAL] need help for PostgreSQL consistency check mechanism

2009-04-23 Thread Alvaro Herrera
Chen, Dongdong (GE Healthcare) wrote: We are now working on database check mechanism in our application. The situation is when server shutdown abnormally, the postmaster.pid file still exists when reboot, But the PostgreSQL database itself may not be damaged. We just do not want to restore

Re: [GENERAL] need help for PostgreSQL consistency check mechanism

2009-04-23 Thread Chen, Dongdong (GE Healthcare)
What is the mechanism about automatic recovery when startup? I read the PostgreSQL document and didnt find anything about this. can you specify that, pls? Thank you so much! B.R. ChenDongdong -Original Message- From: Alvaro Herrera [mailto:alvhe...@commandprompt.com] Sent: Friday,

Re: [GENERAL] need help for PostgreSQL consistency check mechanism

2009-04-23 Thread Joshua D. Drake
On Fri, 2009-04-24 at 09:03 +0800, Chen, Dongdong (GE Healthcare) wrote: What is the mechanism about automatic recovery when startup? I read the PostgreSQL document and didnt find anything about this. can you specify that, pls? http://www.postgresql.org/docs/8.3/static/wal-intro.html

Re: [GENERAL] standard_conforming_strings and pg_escape_string()

2009-04-23 Thread Joshua D. Drake
On Thu, 2009-04-23 at 21:33 +0200, Conrad Lender wrote: Hi. I would like our database abstraction to be able to handle both settings for standard_conforming_strings transparently, i.e. perform the escaping according to the current DB server settings. Since pg_escape_string() is aware of the

Re: [GENERAL] need help for PostgreSQL consistency check mechanism

2009-04-23 Thread Chen, Dongdong (GE Healthcare)
I wanna know if there is any way or tool to detect the DB data loss or damage and inform developer the result before recovery? If there is data loss, the DB could still open or not ? Sometimes even if shutdown abnormally, the data still keep in good condition. Thanks for your help! B.R.

Re: [GENERAL] need help for PostgreSQL consistency check mechanism

2009-04-23 Thread Scott Marlowe
On Thu, Apr 23, 2009 at 8:24 PM, Chen, Dongdong (GE Healthcare) dongdongc...@ge.com wrote: I wanna know if there is any way or tool to detect the DB data loss or damage and inform developer  the result before recovery? If there is data loss, the DB could still open or not ? Sometimes even if

[GENERAL] feature suggestion and return to pgsql-general :-)

2009-04-23 Thread Dennis Gearon
Hi guys, I am back after a long time of doing other kinds of work. Don't know if anybody remembers me - not a biggee. I am again working on a design of a web application for myself. Security seems MUCH more of an issue, EVERY day. So I had these to suggestions/feature requests. To prevent