Re: [GENERAL] Inserting Data

2006-08-24 Thread Michael Fuhr
On Wed, Aug 23, 2006 at 05:34:27PM -0700, Bob Pawley wrote: Could you explain why Postgresql simply doesn't accept the simple 'where' statement that was in my earlier e-mail. Because INSERT doesn't take a WHERE clause. If you want to do the insert conditionally then use an IF statement as Tom

Re: [GENERAL] Inserting Data

2006-08-24 Thread Michael Fuhr
On Wed, Aug 23, 2006 at 07:34:43PM -0700, Bob Pawley wrote: Let me explain. I'll build a simple example based on what you describe. Please make corrections as necessary. I have a table called p_id.devices which accumulates the devices_id for a multitude of differing devices used in PID

Re: [GENERAL] Shared Objects (Dynamic loading)

2006-08-24 Thread Michael Meskes
On Wed, Aug 23, 2006 at 11:41:50PM -0600, Michael Fuhr wrote: Is there a reason this server-side code is using ECPG instead of SPI? To make sure it doesn't work? There is NO guarantee that ECPG will work in this scenario. Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De, Michael

Re: [GENERAL] invalid byte sequence ?

2006-08-24 Thread Martijn van Oosterhout
On Wed, Aug 23, 2006 at 06:52:00PM -0400, Tom Lane wrote: A possible solution therefore is to have psql or libpq drive the client_encoding off the client's locale environment instead of letting it default to equal the server_encoding. But I'm not sure what downsides that would have, and in

[GENERAL] Saving a jpg into Postgresql table

2006-08-24 Thread Gibson
Hi guys, I have a projects using ASP.NET (VB.net) where i upload a jpeg file using a web form and then save the jpeg file into a table. I've decided to use Oid instead of Bytea as i heard that Oid is more memory efficient. So can anyone point me to a website or link where i can see the

Re: [GENERAL] XPath and XML support

2006-08-24 Thread Nikolay Samokhvalov
On 8/24/06, Jeff Davis [EMAIL PROTECTED] wrote: On Wed, 2006-08-23 at 16:04 -0700, Frank Cohen wrote: These look like good XPath functions. Are they actually in PSQL 8.1.4? I did not find them in the Windows installed version. If not, are they recommended? Look at contrib/xml2. The function

[GENERAL] Can't open Postgres at all!!!

2006-08-24 Thread Silvela, Jaime \(Exchange\)
I just came back this morning after doing a REINDEX of pg_class Nothing is working. I try to REINDEX pg_class and it complains ERROR: could not open relation 1663/16390/2662: No such file or directory I try to REINDEX DATABASE and same thing. I can't open any tables. Any ideas? And yes Tom,

[GENERAL] Length limit for query

2006-08-24 Thread Emi Lu
Hello, It appears in MySql 3.23 the limit is 16 MB. In 4.0 and later, it is 1 GB http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html Could someone tell me where I can find PostgreSQL doc about the query length please Tks a lot! Hello, Just curious to know whether postgresql has

Re: [GENERAL] Can't open Postgres at all!!!

2006-08-24 Thread Tom Lane
Silvela, Jaime \(Exchange\) [EMAIL PROTECTED] writes: I just came back this morning after doing a REINDEX of pg_class Nothing is working. I try to REINDEX pg_class and it complains ERROR: could not open relation 1663/16390/2662: No such file or directory If the index entries for the system

Re: [GENERAL] Can't open Postgres at all!!!

2006-08-24 Thread Silvela, Jaime \(Exchange\)
Excuse my ignorance, how do I do that. Linux env setting? Is it a command line option for Postmaster? -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Thursday, August 24, 2006 9:06 AM To: Silvela, Jaime (Exchange) Cc: pgsql-general Subject: Re: [GENERAL] Can't open

Re: [GENERAL] Can't open Postgres at all!!!

2006-08-24 Thread Silvela, Jaime \(Exchange\)
I did setenv PGOPTIONS -P and restarted the database, and still get ERROR: could not open relation 1663/16390/2662 I'm going to try to restore from a previous copy. Any other ideas? Thanks Jaime -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Thursday, August 24,

Re: [GENERAL] invalid byte sequence ?

2006-08-24 Thread Alvaro Herrera
Martijn van Oosterhout wrote: For glibc systems we can get 100% reliable results. Even for other systems there's standard code out there for determining the charset. But this has been discussed before: http://archives.postgresql.org/pgsql-hackers/2003-05/msg00744.php

Re: [GENERAL] Saving a jpg into Postgresql table

2006-08-24 Thread Michael Fuhr
On Thu, Aug 24, 2006 at 06:25:28PM +0800, Gibson wrote: I have a projects using ASP.NET (VB.net) where i upload a jpeg file using a web form and then save the jpeg file into a table. I've decided to use Oid instead of Bytea as i heard that Oid is more memory efficient. See the Large

Re: [GENERAL] invalid byte sequence ?

2006-08-24 Thread Tom Lane
Alvaro Herrera [EMAIL PROTECTED] writes: Martijn van Oosterhout wrote: It seems to me that setting the client encoding based on the client-locale is the *only* sensible way of doing it. Yes please. FWIW I'm not sure if it really belongs in libpq, or it must be rather in psql (and thus in

Re: [GENERAL] Length limit for query

2006-08-24 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Emi Lu wrote: Hello, It appears in MySql 3.23 the limit is 16 MB. In 4.0 and later, it is 1 GB http://dev.mysql.com/doc/refman/4.1/en/packet-too-large.html Could someone tell me where I can find PostgreSQL doc about the query length

[GENERAL] getting around 'out of memory' errors

2006-08-24 Thread Rajarshi Guha
Hi, I've recently been using PostgreSQL and am having some trouble performing an insert. My situation is this: I have a table, A with 15 fields, out of which I am interested in 2 fields, a and b. The table has 8,000,000 rows I have another table, B, which has 3 fields a, c, and d. The field a

Re: [GENERAL] Can't open Postgres at all!!!

2006-08-24 Thread Tom Lane
Silvela, Jaime \(Exchange\) [EMAIL PROTECTED] writes: If the index entries for the system catalogs themselves are hosed, you may have to start the session with PGOPTIONS=-P (to disable trusting system indexes) in order to do REINDEX successfully. Excuse my ignorance, how do I do that. Linux

Re: [GENERAL] getting around 'out of memory' errors

2006-08-24 Thread Tom Lane
Rajarshi Guha [EMAIL PROTECTED] writes: I have a table, A with 15 fields, out of which I am interested in 2 fields, a and b. The table has 8,000,000 rows I have another table, B, which has 3 fields a, c, and d. The field a references field a in table A. Table B is empty at this point. I

[GENERAL] undefined reference to `PQprepare' with postgresql-dev 7.4.7-6sarge2

2006-08-24 Thread Alexander Farber
Hello, I'm trying to compile a libpq program under Debian 3.1r2 with these packages installed: $ dpkg -l | grep postgres ii postgresql 7.4.7-6sarge2 object-relational SQL database management sy ii postgresql-cli 7.4.7-6sarge2 front-end programs for PostgreSQL ii postgresql-con

Re: [GENERAL] undefined reference to `PQprepare' with postgresql-dev

2006-08-24 Thread Stefan Kaltenbrunner
Alexander Farber wrote: Hello, I'm trying to compile a libpq program under Debian 3.1r2 with these packages installed: $ dpkg -l | grep postgres ii postgresql 7.4.7-6sarge2 object-relational SQL database management sy ii postgresql-cli 7.4.7-6sarge2 front-end programs for

Re: [GENERAL] undefined reference to `PQprepare' with postgresql-dev 7.4.7-6sarge2

2006-08-24 Thread Alexander Farber
I've also checked http://www.postgresql.org/docs/7.4/interactive/libpq-exec.html and PQprepare() isn't mentioned there at all. Wasn't it provided in PostgreSQL version 7? Is there a way to workaround it? Maybe by using pqPrepareAsyncResult()? And how could I #ifdef in my libpq-program, to

Re: [GENERAL] undefined reference to `PQprepare' with postgresql-dev 7.4.7-6sarge2

2006-08-24 Thread Tom Lane
Alexander Farber [EMAIL PROTECTED] writes: Does anybody have an idea please, what could I be doing wrong? Trying to use a subroutine added in 8.0 in 7.4. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is

Re: [GENERAL] Can't open Postgres at all!!!

2006-08-24 Thread Joshua D. Drake
Silvela, Jaime (Exchange) wrote: I did setenv PGOPTIONS -P and restarted the database, and still get ERROR: could not open relation 1663/16390/2662 I'm going to try to restore from a previous copy. Any other ideas? If you have a previous copy, do not restore. Fix your hardware. My strong

Re: [GENERAL] undefined reference to `PQprepare' with postgresql-dev 7.4.7-6sarge2

2006-08-24 Thread Alexander Farber
Yes, I'm sorry I didn't expect that it wasn't there (coming to libpq-programming from Perl, where there is always a prepare() function) How could I detect (#ifdef WHAT) an older PostgreSQL version in my C-code? And is there maybe an easy workaround for a missing PQprepare? On 8/24/06, Tom

Re: [GENERAL] invalid byte sequence ?

2006-08-24 Thread Peter Eisentraut
Tom Lane wrote: A possible solution therefore is to have psql or libpq drive the client_encoding off the client's locale environment instead of letting it default to equal the server_encoding. I have been proposing that for years, but just about now the Japanese would speak up and protest ...

[GENERAL] Large database design advice

2006-08-24 Thread Joe Kramer
Hello, I am designing database for a web product with large number of data records. - Few tables but number of objects is tens-hundreds of thousands. - less than 100 queries per second. The application has basically tens thousands of (user) accounts, every account has associated hundreds of

[GENERAL] Dynamic loading (datatype mismatch)

2006-08-24 Thread Jasbinder Bali
Hi, I am dynamically loading a shared object in a function.CREATE OR REPLACE FUNCTION sp_trigger_raw_email(int4, char) RETURNS bool AS'/usr/local/pgsql/jsbali/parser', 'test' LANGUAGE 'c' VOLATILE STRICT; ALTER FUNCTION sp_trigger_raw_email(int4, text) OWNER TO postgres; signature of test is test

Re: [GENERAL] Large database design advice

2006-08-24 Thread Harald Armin Massa
Joe,with a normal serial, without big, you can have 9.223.372.036.854.775.807 records individually numbered. - Few tables but number of objects is tens-hundreds of thousands.- less than 100 queries per second.so you are talking about 10*100*1000=100 in words one million records? That is not

[GENERAL] Inserting Data

2006-08-24 Thread Bob Pawley
Michael You did well interpreting my scribblings. In attempting to use the IF _expression_ (below) I receive an error message stating the return includes two or more rows. This seems to make sense since I am asking if one condition exists (p_id device_number = library device_number

Re: [GENERAL] undefined reference to `PQprepare' with postgresql-dev 7.4.7-6sarge2

2006-08-24 Thread Alexander Farber
Ok, I've upgraded to: $ dpkg -l | grep postgres ii postgresql-8.1 8.1.4-4bpo1object-relational SQL database, version 8.1 ii postgresql-cli 8.1.4-4bpo1front-end programs for PostgreSQL 8.1 ii postgresql-cli 57bpo1 manager for multiple PostgreSQL client versi ii

Re: [GENERAL] Large database design advice

2006-08-24 Thread Michael Fuhr
On Thu, Aug 24, 2006 at 06:21:01PM +0200, Harald Armin Massa wrote: with a normal serial, without big, you can have 9.223.372.036.854.775.807 records individually numbered. Not true; see the documentation: http://www.postgresql.org/docs/8.1/interactive/datatype.html#DATATYPE-SERIAL The type

Re: [GENERAL] invalid byte sequence ?

2006-08-24 Thread Tom Lane
Peter Eisentraut [EMAIL PROTECTED] writes: Tom Lane wrote: A possible solution therefore is to have psql or libpq drive the client_encoding off the client's locale environment instead of letting it default to equal the server_encoding. I have been proposing that for years, but just about now

Re: [GENERAL] Large database design advice

2006-08-24 Thread Michael Fuhr
On Thu, Aug 24, 2006 at 07:19:29PM +0200, Harald Armin Massa wrote: so with serial there are only 2.147.483.648 possible recordnumbers. Actually 2147483647 using the default sequence start value of 1 and going up to 2^31 - 1, the largest positive value a 32-bit integer can hold. You could get

Re: [GENERAL] getting around 'out of memory' errors

2006-08-24 Thread Rajarshi Guha
On Thu, 2006-08-24 at 10:50 -0400, Tom Lane wrote: Rajarshi Guha [EMAIL PROTECTED] writes: I have a table, A with 15 fields, out of which I am interested in 2 fields, a and b. The table has 8,000,000 rows I have another table, B, which has 3 fields a, c, and d. The field a references

[GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Karen Hill
I know that in pgsql.hackers they are discussing what to market the upcoming 8.2 release as. They mention updatable views, but realistically, PostgreSQL has had them via rules forever. I consider myself a database novice , and even I've created updatable views using rules quite easily. It

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Alvaro Herrera
Karen Hill wrote: It would be really great if PostgreSQL supported SQL:2003 Window functions. I know that oracle and sql server have them already, so it would make postgres competitive in that area. I know there is a feature freeze for 8.2, is it doable for 8.3? The sooner you start

Re: [GENERAL] getting around 'out of memory' errors

2006-08-24 Thread Tom Lane
Rajarshi Guha [EMAIL PROTECTED] writes: On Thu, 2006-08-24 at 10:50 -0400, Tom Lane wrote: I think you are getting burnt by the list of pending trigger actions to check the foreign-key references in B. Thanks for the pointer. I've dropped the constraint and am now running the INSERT.

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread AgentM
On Aug 24, 2006, at 14:11 , Alvaro Herrera wrote: Karen Hill wrote: It would be really great if PostgreSQL supported SQL:2003 Window functions. I know that oracle and sql server have them already, so it would make postgres competitive in that area. I know there is a feature freeze for

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Dann Corbit
-Original Message- From: [EMAIL PROTECTED] [mailto:pgsql-general- [EMAIL PROTECTED] On Behalf Of AgentM Sent: Thursday, August 24, 2006 11:27 AM To: PostgreSQL General ML Subject: Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3? On Aug 24, 2006, at 14:11 , Alvaro

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Martijn van Oosterhout
On Thu, Aug 24, 2006 at 02:26:53PM -0400, AgentM wrote: Could someone elaborate on the window functions? This page http:// en.wikipedia.org/wiki/SELECT has some examples but they make it seem like the functions are an overly-verbose LIMIT statement. So what's the benefit? Look for more

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Tom Lane
Martijn van Oosterhout kleptog@svana.org writes: The main thing I want to use them for is for cumulative output. ... With window functions you define for each row a window which is from the beginning of the table to that row and then sum the values, for each row. Then you just divide by the

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Ben
Postgres' DISTINCT ON clause is an example of a window function, though as it stands today it seems to be a special-case hack, instead of an example of a more generalized feature. On Thu, 24 Aug 2006, AgentM wrote: On Aug 24, 2006, at 14:11 , Alvaro Herrera wrote: Karen Hill wrote: It

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Martijn van Oosterhout
On Thu, Aug 24, 2006 at 02:47:20PM -0400, Tom Lane wrote: Martijn van Oosterhout kleptog@svana.org writes: The main thing I want to use them for is for cumulative output. ... With window functions you define for each row a window which is from the beginning of the table to that row and

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Thomas Kellerer
Tom Lane wrote on 24.08.2006 20:47: Perhaps an extremely smart optimizer could improve this using knowledge of the specific aggregates' behaviors, but for black box aggregates it sounds pretty unworkable. I don't know how they do it, but those functions in Oracle are pretty fast. Usually ways

[GENERAL] unsubscrible

2006-08-24 Thread Cleber
- Original Message - From: Michael Fuhr [EMAIL PROTECTED] To: Harald Armin Massa [EMAIL PROTECTED] Cc: Joe Kramer [EMAIL PROTECTED]; Sent: Thursday, August 24, 2006 2:37 PM Subject: Re: [GENERAL] Large database design advice On Thu, Aug 24, 2006 at 07:19:29PM +0200, Harald Armin

Re: [GENERAL] Shared Objects (Dynamic loading)

2006-08-24 Thread Jasbinder Bali
Hi,The way we use ECPG for the database related activites while working with C, what do i need to look up if i'm using perl.As alot of people have pointed out that perl is the best language to use while dealing with email parsing. We have the perl code ready to parse the email.Just wondering what

Re: [GENERAL] Shared Objects (Dynamic loading)

2006-08-24 Thread Frank Finner
On Thu, 24 Aug 2006 15:46:00 -0400 Jasbinder Bali [EMAIL PROTECTED] thought long, then sat down and wrote: Hi, The way we use ECPG for the database related activites while working with C, what do i need to look up if i'm using perl. As alot of people have pointed out that perl is the best

Re: [GENERAL] getting around 'out of memory' errors

2006-08-24 Thread Rajarshi Guha
On Thu, 2006-08-24 at 14:12 -0400, Tom Lane wrote: Rajarshi Guha [EMAIL PROTECTED] writes: On Thu, 2006-08-24 at 10:50 -0400, Tom Lane wrote: I think you are getting burnt by the list of pending trigger actions to check the foreign-key references in B. Thanks for the pointer. I've

[GENERAL] lock table problem

2006-08-24 Thread marcelo Cortez
folk the pg_statistics show too many lock table ( fron my app.) and all of them is in waiting state. the only way to go out from this situation is restart the cluster. where is the way to investigate lock's table tree ? any clue? best regards MDC

Re: [GENERAL] XPath and XML support

2006-08-24 Thread Frank Cohen
Thanks Nikolay: Seeing as xml2 hasn't been ported to Windows yet makes me wonder if this is going to be the best way to use XML in PostgreSQL in the long-term? Is there anything else on the boards? - Frank On Aug 24, 2006, at 4:17 AM, Nikolay Samokhvalov wrote: On 8/24/06, Jeff Davis

Re: [GENERAL] Shared Objects (Dynamic loading)

2006-08-24 Thread Michael Fuhr
On Thu, Aug 24, 2006 at 03:46:00PM -0400, Jasbinder Bali wrote: The way we use ECPG for the database related activites while working with C, what do i need to look up if i'm using perl. For information about writing server-side Perl functions see the PL/Perl documentation (adjust the link if

Re: [GENERAL] invalid byte sequence ?

2006-08-24 Thread Karsten Hilbert
On Thu, Aug 24, 2006 at 01:17:49PM -0400, Tom Lane wrote: I guess the key point might be what do we do if the client locale is C? Perhaps if it's C, we continue to use the server encoding as we have in the past. This would be a reasonable fallback in other cases where we fail to deduce an

[GENERAL] FW: Serverlog 100GB

2006-08-24 Thread Randy How
Greetings, We're running PostGres on linux, version 8.1.x. on a new server for a few weeks.Andthe serverlog just consumed the rest of the disk space - 100GB log file. Wow, that's a personal record. I'm nota Linux guru so if you could pointme in the right direction I'dappreciate it. How

Re: [GENERAL] SQL:2003 Window Functions for postgresql 8.3?

2006-08-24 Thread Christopher Browne
Clinging to sanity, [EMAIL PROTECTED] (Tom Lane) mumbled into her beard: Martijn van Oosterhout kleptog@svana.org writes: The main thing I want to use them for is for cumulative output. ... With window functions you define for each row a window which is from the beginning of the table to that

Re: [GENERAL] lock table problem

2006-08-24 Thread Tom Lane
marcelo Cortez [EMAIL PROTECTED] writes: the pg_statistics show too many lock table ( fron my app.) and all of them is in waiting state. the only way to go out from this situation is restart the cluster. Surely a few query cancels would be sufficient. where is the way to investigate

Re: [GENERAL] FW: Serverlog 100GB

2006-08-24 Thread Tom Lane
Randy How [EMAIL PROTECTED] writes: We're running PostGres on linux, version 8.1.x. on a new server for a few weeks. And the serverlog just consumed the rest of the disk space - 100GB log file. Wow, that's a personal record. Perhaps choose less verbose logging settings? But really the