Re: [GENERAL] Find out encoding of data

2007-10-02 Thread Albe Laurenz
joynes wrote: > What I really want to see is the hexadecimal or octal value > of the bytes of the retrieved data. Can postgres give me > this somehow (without exporting tables to files and look at > the files). Maybe 'decode' can help you: test=> SELECT decode('10EUR', 'escape'); decode

Re: [GENERAL] how to ignore invalid byte sequence for encoding without using sql_ascii?

2007-10-02 Thread Martijn van Oosterhout
On Thu, Sep 27, 2007 at 02:28:27AM -0700, [EMAIL PROTECTED] wrote: > I am now importing the dump file of wikipedia into my postgresql using > maintains/importDump.php. It fails on 'ERROR: invalid byte sequence > for encoding UTF-8'. Is there any way to let pgsql just ignore the > invalid characters

Re: [GENERAL] more problems with count(*) on large table

2007-10-02 Thread Martijn van Oosterhout
On Mon, Oct 01, 2007 at 01:34:32PM -0400, Bill Moran wrote: > This sounds like a caching issue. My guess at what's happening is that > other operations are pushing this data out of the shared_buffers, so > when you run it, the system has to pull a bunch of tuples off the disk > to check them. If

Re: [GENERAL] more problems with count(*) on large table

2007-10-02 Thread Tomasz Ostrowski
On Mon, 01 Oct 2007, Mike Charnoky wrote: > I altered the table in question, with "set statistics 100" on the > timestamp column, then ran analyze. This seemed to help somewhat. Now, > queries don't seem to hang, but it still takes a long time to do the count: > * "where evtime between '2007-09

Re: [GENERAL] windows and pg 8.2 (change database to another server)

2007-10-02 Thread Magnus Hagander
On Mon, Oct 01, 2007 at 11:38:53PM +0200, Terry Yapt wrote: > Magnus Hagander escribió: > >On Sun, Sep 30, 2007 at 11:36:23PM +0200, Terry Yapt wrote: > >>First of all. I think this method is admisible. Isn't it ? > >> > > > >It is. > > > > Glad to read it :-) > > >>And second questio

[GENERAL] Execution plan caching

2007-10-02 Thread Philippe Lang
Hi, I have recently used the MS SQL Server 2005 database, and found out that there is no mecanism where an execution plan can be reused between two successive calls to a view. This is only true with stored procedures. Is that also true with the Postgresql engine? Philippe --

[GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
Hi there, I am trying to find in a table with different variables, countries and years the lowest year and within that year the lowest value The following SELECT works, but I wonder if it is "elegant". Can you recommend any other solution? SELECT

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Richard Huxton
Stefan Schwarzer wrote: Hi there, I am trying to find in a table with different variables, countries and years the lowest year and within that year the lowest value The following SELECT works, but I wonder if it is "elegant". Can you recommend any other solution? SELECT value A

Re: [GENERAL] Execution plan caching

2007-10-02 Thread Richard Huxton
Philippe Lang wrote: Hi, I have recently used the MS SQL Server 2005 database, and found out that there is no mecanism where an execution plan can be reused between two successive calls to a view. This is only true with stored procedures. Is that also true with the Postgresql engine? Well, if

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
Hi there, I am trying to find in a table with different variables, countries and years the lowest year and within that year the lowest value The following SELECT works, but I wonder if it is "elegant". Can you recommend any other solution? SELECT value AS minv FROM public_on_table.d

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Richard Huxton
Stefan Schwarzer wrote: Hi there, I am trying to find in a table with different variables, countries and years the lowest year and within that year the lowest value The following SELECT works, but I wonder if it is "elegant". Can you recommend any other solution? SELECT value AS minv

Re: [GENERAL] Execution plan caching

2007-10-02 Thread Douglas McNaught
"Philippe Lang" <[EMAIL PROTECTED]> writes: > Hi, > > I have recently used the MS SQL Server 2005 database, and found out that > there is no mecanism where an execution plan can be reused between two > successive calls to a view. This is only true with stored procedures. > > Is that also true with

Re: [GENERAL] Strange discrepancy in query performance...

2007-10-02 Thread Tom Lane
"Jason L. Buberel" <[EMAIL PROTECTED]> writes: > For reference, when using JasperReports .jrxml files as the basis for > the query, I only had to do to the following to 'force' postgres to > treat the jasper report parameter as a number and not text, thereby > allowing the correct index to be us

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
SELECT year, value FROM ... I feel ashamed such a simple solution... gush Thanks for that! Unfortunately it doesn't stop there... If I want to find the "common smallest year" for two given variables (say, I have years 1970, 1971, 2005 for variable 1 (GDP) and 1980, 1981,... 200

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Richard Huxton
Stefan Schwarzer wrote: SELECT year, value FROM ... I feel ashamed such a simple solution... gush Thanks for that! Can be easy to over-complicate things when you've been thinking about them too long. Unfortunately it doesn't stop there... If I want to find the "common smallest ye

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Michael Glaesemann
On Oct 2, 2007, at 9:29 , Stefan Schwarzer wrote: How would I do that? I really have no clue... The key is to build it up in steps. select id_country, year, var_1, val_1, var_2, val_2 -- Second step: -- value for year for each country of var_1 from (select id_country, year, id_variable as va

Re: [GENERAL] Strange discrepancy in query performance...

2007-10-02 Thread Jason L. Buberel
I agree that this is a bug in JasperReports. I've been stepping throgh their code to determine where the paramter type is set to 'java.lang.String', but have not yet figured out how their Java API will allow me to override that with 'java.lang.Integer' or something more appropriate. If I figu

Re: [GENERAL] Partitioned table limitation

2007-10-02 Thread Goboxe
> > I've played around with as many as 1,000 child tables. By then, the > planning time becomes noticeably longer than for a single table, but > the response time is still so much faster that it's worth it. Note > I'm talking only a fraction of a second planning time, even at 1,000 > tables. > >

[GENERAL] Feature Request - Defining default table space for Indexes in Conf file

2007-10-02 Thread S Sharma
Hi All, The default table space defined in db conf file is used for all database tables as well as indexes. So putting the indexes on another table space requires manually dropping and re-creating indexes. It would be nice to have a feature to define a default table space for indexes in db conf

Re: [GENERAL] It's time to support GRANT SELECT,UPDATE,...,...,... ON database.* to username

2007-10-02 Thread Scott Marlowe
On 10/1/07, MrKrinkle <[EMAIL PROTECTED]> wrote: > On Oct 1, 7:28 am, "Ben Trewern" <[EMAIL PROTECTED]> wrote: > > > You can use the pgAdmin's grant wizard to do what you want. > > > > I shouldn't need a GUI tool to do something so mundane. And you don't. Very very simple plsql code to do it has

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Steve Crawford
Stefan Schwarzer wrote: >> SELECT year, value FROM ... > > I feel ashamed such a simple solution... gush Thanks for that! > > Unfortunately it doesn't stop there... > > If I want to find the "common smallest year" for two given variables > (say, I have years 1970, 1971, 2005 for vari

[GENERAL] Select too many ids..

2007-10-02 Thread Abandoned
Hi.. I have a id list and id list have 2 million dinamic elements.. I want to select what id have point.. I try: SELECT id, point FROM table WHERE id in (IDLIST) This is working but too slowly and i need to performance.. I'm sorry my bad english. King regards.. ---(end

Re: [GENERAL] It's time to support GRANT SELECT,UPDATE,...,...,... ON database.* to username

2007-10-02 Thread MrKrinkle
On Oct 1, 7:28 am, "Ben Trewern" <[EMAIL PROTECTED]> wrote: > You can use the pgAdmin's grant wizard to do what you want. > I shouldn't need a GUI tool to do something so mundane. > > BTW thanks for the polite e-mail. :-/ Given that it's been four years and countless requests for this, a wakeup

Re: [GENERAL] Find out encoding of data

2007-10-02 Thread joynes
Hi! This doesnt work for me but it is exactly what I want. When I run your example I just get: >SELECT decode('10EUR', 'escape'); decode 10EUR (1 rad) I get the same result, both if the database is UTF8 or ISO-Latin1 and also with different versions of postgres (7 and 8) And when I

Re: [GENERAL] It's time to support GRANT SELECT,UPDATE,...,...,... ON database.* to username

2007-10-02 Thread Chris Browne
[EMAIL PROTECTED] ("Scott Marlowe") writes: > About 75% of the time I see that response, it comes with the actual > code to do just that. I.e. cut and paste and voila, you've got the > functions. > >> You write the function. Fuck the standard and >> wake up. > > Me? What about you? The fact is t

Re: [GENERAL] Partitioned table limitation

2007-10-02 Thread Goboxe
On Oct 2, 1:38 am, [EMAIL PROTECTED] ("paul rivers") wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:pgsql-general- > > [EMAIL PROTECTED] On Behalf Of Goboxe > > Sent: Monday, October 01, 2007 2:18 AM > > To: [EMAIL PROTECTED] > > Subject: [GENERAL] Partitioned table limit

[GENERAL] pgcrypto digest_exists replacement?

2007-10-02 Thread Nasby Jim
I see that digest_exists is now gone, but I haven't been able to find anything in the lists about why... I was actually going to make use of that; is there anything that replaces it? -- Decibel! [EMAIL PROTECTED] (512) 569-9461 ---(end of broadcast)-

[GENERAL] Strange behavior of TRIGGER

2007-10-02 Thread Nurlan Mukhanov
There is a table with unique rows. But before insert trigger checks data and returns NULL if such record exist and NEW if not. But from time to time I'm getting an error in my log file faled query: INSERT INTO viewed_members (member_id, viewed_id) VALUES ('93701','41719') context: ERROR: duplicat

Re: [GENERAL] Feature Request - Defining default table space for Indexes in Conf file

2007-10-02 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/01/07 13:22, S Sharma wrote: > Hi All, > > The default table space defined in db conf file is used for all database > tables as well as indexes. So putting the indexes on another table space > requires manually dropping and re-creating indexes.

Re: [GENERAL] Select too many ids..

2007-10-02 Thread Scott Marlowe
On 10/1/07, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I have a id list and id list have 2 million dinamic elements.. > I want to select what id have point.. > I try: > > SELECT id, point FROM table WHERE id in (IDLIST) > > This is working but too slowly and i need to performance.. > > I'm sorry

Re: [GENERAL] Select too many ids..

2007-10-02 Thread Rodrigo De León
On 10/1/07, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I have a id list and id list have 2 million dinamic elements.. > I want to select what id have point.. > I try: > > SELECT id, point FROM table WHERE id in (IDLIST) > > This is working but too slowly and i need to performance.. > > I'm sorry

[GENERAL] create visual query in web applications

2007-10-02 Thread Ottavio Campana
Do you know any library or application so that a user could create visually a query in a web application? I think that now with ajax and web 2.0 it should be possible, but I don't know any product that does it. signature.asc Description: OpenPGP digital signature

Re: [GENERAL] more problems with count(*) on large table

2007-10-02 Thread Mike Charnoky
The db server is pretty beefy: 2x Xeon 3.20 GHz with 6G RAM. The io subsystem is a 550G 4-disk SATA 150 RAID 10 array connected via a 3ware 9500S-8 controller (Seagate Nearline ST3400632NS drives). Currently, shared_buffers is set to 5 (nearly 400M) As for the data stored in this large table

Re: [GENERAL] Find min year and min value

2007-10-02 Thread hubert depesz lubaczewski
On Tue, Oct 02, 2007 at 04:29:02PM +0200, Stefan Schwarzer wrote: > If I want to find the "common smallest year" for two given variables > (say, I have years 1970, 1971, 2005 for variable 1 (GDP) and > 1980, 1981,... 2003) for variable 2 (Fish Catch) ). It should come up > with 1980 for a

Re: [GENERAL] more problems with count(*) on large table

2007-10-02 Thread Bill Moran
In response to Mike Charnoky <[EMAIL PROTECTED]>: > The db server is pretty beefy: 2x Xeon 3.20 GHz with 6G RAM. The io > subsystem is a 550G 4-disk SATA 150 RAID 10 array connected via a 3ware > 9500S-8 controller (Seagate Nearline ST3400632NS drives). Currently, > shared_buffers is set to 5000

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Michael Glaesemann
On Oct 2, 2007, at 11:10 , Steve Crawford wrote: As others have noted, the query *can* be written. But it appears to me that you are struggling against your table layout. The current schema he has is commonly called EAV (entity-attribute- value) and is generally frowned upon. Now, in his par

Re: [GENERAL] Strange behavior of TRIGGER

2007-10-02 Thread Jeff Davis
On Mon, 2007-10-01 at 23:19 +0600, Nurlan Mukhanov wrote: > There is a table with unique rows. But before insert trigger checks > data and returns NULL if such record exist and NEW if not. > > But from time to time I'm getting an error in my log file > > faled query: INSERT INTO viewed_members (m

Re: [GENERAL] It's time to support GRANT SELECT,UPDATE,...,...,... ON database.* to username

2007-10-02 Thread Jeff Davis
On Tue, 2007-10-02 at 12:06 -0400, Chris Browne wrote: > It has tended to turn into recommendations to "write a function" > because the desired functionality is almost never a constant. People > *claim* that they want to grant access to everything, but there are > commonly exceptions. > > "Oh, bu

Re: [GENERAL] It's time to support GRANT SELECT,UPDATE,...,...,... ON database.* to username

2007-10-02 Thread Jeff Davis
On Mon, 2007-10-01 at 10:52 -0700, MrKrinkle wrote: > Given that it's been four years and countless requests for this, a > wakeup call style email is justified. > A "wakeup call" might be justified if: (1) it's on -advocacy (after all, the primary threat in his email is that we would lose users..

Re: [GENERAL] It's time to support GRANT SELECT,UPDATE,...,...,... ON database.* to username

2007-10-02 Thread Joshua D. Drake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jeff Davis wrote: > On Tue, 2007-10-02 at 12:06 -0400, Chris Browne wrote: >> It has tended to turn into recommendations to "write a function" >> because the desired functionality is almost never a constant. People >> *claim* that they want to grant a

Re: [GENERAL] Partitioned table limitation

2007-10-02 Thread paul rivers
> -Original Message- > From: [EMAIL PROTECTED] [mailto:pgsql-general- > [EMAIL PROTECTED] On Behalf Of Goboxe > Sent: Monday, October 01, 2007 11:26 AM > To: pgsql-general@postgresql.org > Subject: Re: [GENERAL] Partitioned table limitation > > On Oct 2, 1:38 am, [EMAIL PROTECTED] ("paul

[GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Ross Bagley
Newbie to pl/pgsql here. I'm trying to create a function that cleans up the foreign keys referring to a particular row (if any exist), then removes the row (if it exists), and returns the number of rows of br_role that were deleted (0 or 1). Newbie stored procedure: CREATE OR REPLACE FUNCTION de

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Alvaro Herrera
Ross Bagley wrote: > I did come across FOUND, which leads to this: > > CREATE OR REPLACE FUNCTION delete_role(del_role_pk bigint) RETURNS int AS $$ > BEGIN > DELETE FROM br_actor_role_mm WHERE role_fk = del_role_pk; > DELETE FROM br_role_permission_mm WHERE role_fk = del_role_pk; > DE

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Joshua D. Drake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ross Bagley wrote: > Newbie to pl/pgsql here. > > I'm trying to create a function that cleans up the foreign keys > referring to a particular row (if any exist), then removes the row (if > it exists), and returns the number of rows of br_role that wer

[GENERAL] PITR and Compressed WALS

2007-10-02 Thread Brian Wipf
We have two PostgreSQL 8.2.4 servers. On one database, WALs are archived with a simple script that gzips and transfers them to an NFS file server. The other database is in perpetual recovery mode, ungizipping and processing the WALs as they appear and become complete on the file server. Thi

[GENERAL] Can't access Cluster

2007-10-02 Thread Ralph Smith
I'm using 7.4 before we upgrade. pg_dumpall worked fine on working cluster. I Imported it all into a virgin install of 7.4 on a different box. Used pg_ctl to restart that box after the import. All went fine. On trying to connect as a valid user on that database I get: DATE TIME FATAL: IDEN

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Ross Bagley
On 10/2/07, Alvaro Herrera <[EMAIL PROTECTED]> wrote: > Right. Use GET DIAGNOSTICS foo = ROW_COUNT Works great! Thank you. Ross -- Ross Bagley "Security is mostly a superstition. It does not exist in nature... Life is either a daring adventure or nothing." -- Helen Keller -

Re: [GENERAL] Finding number of rows deleted in a stored procedure

2007-10-02 Thread Ross Bagley
In this simplified case, given an open SQL connection, you're correct. That would simplify this query, and I'm a little embarrassed not to have seen that (obexcuse: I've been spending too much time in Java-land lately). There is more to the function than I included in my question, so it does need

[GENERAL] pg_dump

2007-10-02 Thread Bob Pawley
I want to be able to convert a PostgreSQL database to other formats such as Oracle, Access etc. - with, as well as without, the data. Can this task be accomplished by employing pg_dump in SQL? Bob Pawley

Re: [GENERAL] pg_dump

2007-10-02 Thread Joshua D. Drake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bob Pawley wrote: > I want to be able to convert a PostgreSQL database to other formats such as > Oracle, Access etc. - with, as well as without, the data. > > Can this task be accomplished by employing pg_dump in SQL? If you dump with inserts, dat

Re: [GENERAL] pg_dump

2007-10-02 Thread Bob Pawley
Is there a better method of transfering the database and data to between DBs? Bob - Original Message - From: "Joshua D. Drake" <[EMAIL PROTECTED]> To: "Bob Pawley" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, October 02, 2007 3:26 PM Subject: Re: [GENERAL] pg_dump -BEGIN PGP SIGNED

[GENERAL] PITR Recovery and out-of-sync indexes

2007-10-02 Thread Brian Wipf
We are running a production server off of a new database that was synchronized using PITR recovery. We found that many of the btree indexes were out of sync with the underlying data after bringing the new server out of recovery mode, but the data itself appeared to be okay. Both servers h

Re: [GENERAL] pg_dump

2007-10-02 Thread Joshua D. Drake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Bob Pawley wrote: > Is there a better method of transfering the database and data to between > DBs? Use your favorite language to do so. Joshua D. Drake > > Bob > > > - Original Message - From: "Joshua D. Drake" <[EMAIL PROTECTED]> > To:

Re: [GENERAL] pg_dump

2007-10-02 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 One table or many? Transactionally consistent? Live connection or intermittent? On 10/02/07 17:37, Bob Pawley wrote: > Is there a better method of transfering the database and data to between > DBs? > > Bob > > > - Original Message - Fro

Re: [GENERAL] pg_dump

2007-10-02 Thread Adrian Klaver
On Tuesday 02 October 2007 3:37 pm, Bob Pawley wrote: > Is there a better method of transfering the database and data to between > DBs? > > Bob > > From the Postgres website PgFoundry project http://pgfoundry.org/projects/dbi-link/ Commercial products http://www.dbconvert.com/ More commercial pr

Re: [GENERAL] datestyle question

2007-10-02 Thread Diego Gil
El jue, 27-09-2007 a las 10:32 +0200, Alban Hertroys escribió: > Diego Gil wrote: > > Hi, > > > > I have a file to import to postgresql that have an unusual date format. > > For example, Jan 20 2007 is 20022007, in DDMM format, without any > > separator. I know that a 20072002 (MMDD) is ok

Re: [GENERAL] datestyle question

2007-10-02 Thread Erik Jones
On Oct 2, 2007, at 8:56 PM, Diego Gil wrote: El jue, 27-09-2007 a las 10:32 +0200, Alban Hertroys escribió: Diego Gil wrote: Hi, I have a file to import to postgresql that have an unusual date format. For example, Jan 20 2007 is 20022007, in DDMM format, without any separator. I know

Re: [GENERAL] Find out encoding of data

2007-10-02 Thread Albe Laurenz
joynes wrote: > This doesnt work for me but it is exactly what I want. When I run your > example I just get: > > >SELECT decode('10EUR', 'escape'); > decode > > 10EUR > (1 rad) > > I get the same result, both if the database is UTF8 or > ISO-Latin1 and also > with different versions

Re: [GENERAL] Can't access Cluster

2007-10-02 Thread Albe Laurenz
Ralph Smith wrote: > I'm using 7.4 before we upgrade. > pg_dumpall worked fine on working cluster. > I Imported it all into a virgin install of 7.4 on a different box. > Used pg_ctl to restart that box after the import. All went fine. > > > On trying to connect as a valid user on that database I

Re: [GENERAL] Find min year and min value

2007-10-02 Thread Stefan Schwarzer
As others have noted, the query *can* be written. But it appears to me that you are struggling against your table layout. The current schema he has is commonly called EAV (entity-attribute- value) and is generally frowned upon. Now, in his particular case it may be justified if the "value"