[GENERAL] Copy of a schema
Hi, I wonder whether it is possible to copy a schema with a postgreSQL command like "copy_schema schema_src schema_dest" ? It would be interesting for the development and the tests to be able to work on a copy of a schema without having to make a dump of database and to insert it in a new database or a new schema. Regards. -- == | FREDERIC MASSOT | | http://www.juliana-multimedia.com | | mailto:[EMAIL PROTECTED] | ===Debian=GNU/Linux=== ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] improve 'where not exists' query..
Noel Whelan wrote: I executed the following: EXPLAIN ANALYZE SELECT cwit.cempid FROM "cwItems" cwit WHERE (NOT (EXISTS (SELECT con.cempid FROM contacts con WHERE (con.cempid = cwit.cempid; It comes back with: Seq Scan on "cwItems" cwit (cost=0.00..8929702.11 rows=5132 width=8) (actual time=132218.29..148623.27 rows=31 loops=1) Filter: (NOT (subplan)) SubPlan -> Seq Scan on contacts con (cost=0.00..870.77 rows=1 width=8) (actual time= 11.82..11.82 rows=1 loops=12528) Filter: (cempid = $0) Total runtime: 148623.54 msec I'm not certain it's an issue with the query itself going wrong. I consider I'm basically telling it: for each cempid in 'cwItems', check whether or not it exists as a cempid in 'contacts', which could be inherently inefficient in itself. Well, as you say it's never going to be possible without checking all items. However, you've got two seq-scans there and I'd expect a seq-scan and looping over an index (or a hash-based plan perhaps). Now, looking at the values it's only seeing 31 rows in cwItems and 1 row (!) in contacts, so that would explain the scans. However, in that case I'd expect it to be much faster than it is. Hmm - I'd take the following steps: 1. VACUUM FULL VERBOSE ANALYSE on both those tables and then see what happens. Make a note of how many removable/non-removable rows it finds. Rerun the explain analyse and see what happens. 2. Check that you have an index on contact.cempid and that the types of cempid match in both tables. Then issue "SET enable_seqscan=true" and run the explain analyse again - are things faster? Let us know what happens, oh and don't forget to cc: the list, you were lucky I read this. I just wondered if there'd be a way to improve on it or not. Installation is postgres-7.3.4. Upgrade to the latest 7.3.x version as soon as is convenient - lots of bug fixes to be had. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] Copy of a schema
am 27.10.2005, um 11:13:43 +0200 mailte Frederic Massot folgendes: > Hi, > > I wonder whether it is possible to copy a schema with a postgreSQL command > like "copy_schema schema_src schema_dest" ? You can rename a schema. And, you can make a dump, then rename it, and then restore from backup. Or, make a backup, edit this file and restore it. Attention: if you have sequences (for instance), you getting problems because the table-definitions references the wrong schema. HTH, Andreas -- Andreas Kretschmer(Kontakt: siehe Header) Heynitz: 035242/47212, D1: 0160/7141639 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net ===Schollglas Unternehmensgruppe=== ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] a stored procedure ..with integer as the parameter
Title: Re: [GENERAL] a stored procedure ..with integer as the parameter My appliaction is in C++ and i am getting char* ..s which i need to insert into the table...and for insert i am calling a stored procedure. But i need to form the call to the stored procedure with the above char*s as the argument. From: Richard Huxton [mailto:[EMAIL PROTECTED]Sent: Wed 10/26/2005 12:40 PMTo: surabhi.ahujaCc: Tino Wildenhain; Stephan Szabo; pgsql-general@postgresql.orgSubject: Re: [GENERAL] a stored procedure ..with integer as the parameter ***Your mail has been scanned by InterScan VirusWall.***-***surabhi.ahuja wrote:> what do u suggest i do then in that case?> i mean how should i make a query - i mean how do i make a command?You should always provide well-defined escaping to all data coming froma non-trusted source (i.e. outside your application) and preferably toall data in any case.If you are using "C" then libpq offers functions to escape strings.Almost all other languages offer something similar.In general, I never use "raw" functions to build my queries, I havewrapper functions that ensure all queries are well-formed.What language are you using, and what framework?-- Richard Huxton Archonet Ltd
Re: [GENERAL] Why database is corrupted after re-booting
On 26 Oct 2005, at 19:43, snacktime wrote: I remember a few months back when someone hit the emergency power switch to the whole floor where we host at Internap. Subsequently the backup power system had a cascading failure. Livejournal, who also hosts there, was up all night and into the next day restoring their mysql databases after a bunch of them were corrupted. I believe they had write cache turned on. Of course our postgresql servers on scsi drives came right back up. If it wasn't for a couple of servers that won't reboot automatically if the power goes out I wouldn't have even had to go down to the data center. Chris I don't know about this you know. Power failures can cause seriously random failures on most PC hardware. A few weeks ago we had a RAID 1 (fsync on, caching off, battery backed raid controller etc) system get it's RAID partitions gets totally fried by a power failure. My suspicion is that if the power failure isn't a particularly fast one, (e.g. you overloaded a fuse somewhere, fuses are insanely slow to fail compared to alternatives like MCBs) then your RAID card's RAM will get corrupted as the voltage drops or the system memory will resulting in bad data getting copied to the RAID controller as RAM seems to be pretty sensitive to voltage variations in experiments i've done on my insanely tweak-able desktop at home. I would of though ECC probably helps, but it can only correct so much. Of course I'm not an electrical engineer (although my friend is a member of IEEE and he seemed to agree it was a possibility) doesn't the possibility of this kinda make things a bit more complicated and/ or expensive to maintain data integrity during a power failure? ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
[GENERAL] creating users in groups, in 8.1
Hello. I had the following function in Postgres 8.0.4 for creation of users inside existing groups. Now I need to adjust it for new Roles system. What do I neeed to change? Especially regarding: CMD := 'CREATE USER "' || l_username || '" WITH ENCRYPTED PASSWORD ''' || l_password || ''' IN GROUP "' || l_group || '" VALID UNTIL ''' || l_validity || ; Thanks in advance, Zlatko -- Function: alter_group(name, bool, name, varchar) -- DROP FUNCTION alter_group(name, bool, name, "varchar"); CREATE OR REPLACE FUNCTION alter_group(name, bool, name, "varchar") RETURNS bool AS $BODY$ DECLARE l_group ALIAS FOR $1; l_create_user ALIAS FOR $2; l_username ALIAS FOR $3; l_password ALIAS FOR $4; l_validity timestamp; CMD VARCHAR; MIN_SUPER_USER INTEGER := 1; BEGIN select into l_validity "rok_valjanosti"."rok_valjanosti" FROM ( SELECT min("rok_valjanosti"."rv_id") AS "rv_id", "rok_valjanosti"."rok_valjanosti" FROM "rok_valjanosti" GROUP BY "rok_valjanosti"."rv_id", "rok_valjanosti"."rok_valjanosti") sve; IF (l_create_user NOTNULL) THEN IF (l_create_user) THEN CMD := 'CREATE USER "' || l_username || '" WITH ENCRYPTED PASSWORD ''' || l_password || ''' IN GROUP "' || l_group || '" VALID UNTIL ''' || l_validity || ; EXECUTE CMD; ELSE CMD := 'DROP USER "' || l_username || '"'; EXECUTE CMD; END IF; IF (SELECT COUNT(*) FROM "user_group_view" WHERE "groupname" ='{ADMINS}') < MIN_SUPER_USER THEN RAISE EXCEPTION 'At least % admin(s) in group ADMINS must be defined in order to create new user accounts.', MIN_SUPER_USER; END IF; END IF; RETURN TRUE; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE SECURITY DEFINER; ALTER FUNCTION alter_group(name, bool, name, "varchar") OWNER TO matalab; GRANT EXECUTE ON FUNCTION alter_group(name, bool, name, "varchar") TO matalab; GRANT EXECUTE ON FUNCTION alter_group(name, bool, name, "varchar") TO GROUP "ADMINS"; ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] a stored procedure ..with integer as the parameter
surabhi.ahuja wrote: My appliaction is in C++ and i am getting char* ..s which i need to insert into the table...and for insert i am calling a stored procedure. But i need to form the call to the stored procedure with the above char*s as the argument. Fine - just make sure you validate your data and format it properly. If you are expecting an integer and a text field then check that the first is a valid integer and escape any single quotes in the text-field. Then you can build your query as you are at the moment. I'm afraid I don't know much about the libpqxx C++ library, but it must have facilities to escape quotes etc. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
[GENERAL] Problem with SSL and postgreSQL 8.0.4
Hi, I have installed postgresql 8.0.4 onto my linux distro (SuSe 9.3 PRO). I configured the build to support SSL: ./configure --with-openssl To start postgresql I use the following command: /usr/local/pgsql/bin/postmaster -i -D /usr/local/pgsql/data In my data folder I have my server.crt and server.key files. I have excluded the root.crt file as the current postgresql drivers cannot pass certificates. The readout from starting postgresql is as follows: LOG: database system was shut down at 2005-10-26 22:13:58 BST LOG: checkpoint record is at 0/A44F24 LOG: redo record is at 0/A44F24; undo record is at 0/0; shutdown TRUE LOG: next transaction ID: 548; next OID: 17232 LOG: database system is ready As you can see there is no message to say that the root.crt file is missing, which I hav received in previous installs of postgresql, and of course when I try to access postgresql via jboss 4 using an ssl url I get a message saying that postgresql does not support SSL!! What am I missing here? regards Uzo
Re: [GENERAL] Why database is corrupted after re-booting
>> Why the corruption occurs ? > > Most likely because the IDE was caching the information. IDE drives > sometimes lie about having caching turned on or off. > >> Will NTFS file system prevent all corruptions ? > > No. Joshua, thank you. Please re-confirm. In the configuration 1. Windows XP 2. QUANTUM FIREBALLP LM20.5 (IDE drive) 3. Write caching is off in XP device manager 4. fsync is ON in Postgres 8 5. NTFS file system following may occur: a. Power failure (or its simulation by pressing RESET button) causes Postgres database to be corrupted. b. No automatic repair/rollback is perfomed. c. Only way to bring database back online is to restore from backup My problem: Sometimes I need also to run desktop (server and client in same desktop computer) applications with Postgres. Desktop computer have this config. It is not possible to force users to buy SCSI drives nor upses for each desktop computer. Can Firebird or SQLLite automatically recover from power failure? Andrus. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
[GENERAL] missing FROM clause ?
Hello. In Postgres 8.1 I have a message that there is a missing FROM clause in the following query: select into l_validity "rok_valjanosti"."rok_valjanosti" FROM ( SELECT min("rok_valjanosti"."rv_id") AS "rv_id", "rok_valjanosti"."rok_valjanosti" FROM "rok_valjanosti" GROUP BY "rok_valjanosti"."rv_id", "rok_valjanosti"."rok_valjanosti") sve; If I change parameter "add missing from" in postgresl.conf to "on" than it works... I would like to include FROM clause, but can't see where. Thanks, Zlatko
Re: [GENERAL] Problem with SSL and postgreSQL 8.0.4
On Thu, Oct 27, 2005 at 11:46:16AM +0100, Uzo Madujibeya wrote: > As you can see there is no message to say that the root.crt file is missing, > which I hav received in previous installs of postgresql, and of course when > I try to access postgresql via jboss 4 using an ssl url I get a message > saying that postgresql does not support SSL!! Did you enable ssl in postgresql.conf? -- Michael Fuhr ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] Why database is corrupted after re-booting
Andrus wrote: My problem: Sometimes I need also to run desktop (server and client in same desktop computer) applications with Postgres. Desktop computer have this config. It is not possible to force users to buy SCSI drives nor upses for each desktop computer. Can Firebird or SQLLite automatically recover from power failure? If data on your disk gets corrupted then NOTHING can guarantee to recover your database - not PG, not Firebird, not Oracle. PostgreSQL writes all transactions to a log (WAL) before reporting them as committed. If your system tells the truth about when data is actually written to disk, then it can use this WAL to find out what happened when the system stopped and make sure the database is in a consistent state. Now, if your WAL gets corrupted then obviously there's not much PG can do about it - that's why it's vital to make sure that write caching is off, so PG can guarantee that something written to disk is actually there. Now, since you're not going to control your clients' hardware, and probably can't guarantee their settings either you'll have to accept a greater risk of data loss than with good quality hardware you specify yourself. There are steps you can take to protect their data though - running on NTFS, telling them to switch write caching off and, I would suggest looking into running a PITR setup on the same machine. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [GENERAL] Problem with SSL and postgreSQL 8.0.4
On Thu, Oct 27, 2005 at 12:26:35PM +0100, Uzo Madu wrote: > On Thursday 27 October 2005 12:17, you wrote: > > Did you enable ssl in postgresql.conf? > > refresh my mind please, what is it i'm meant to alter in my postgresql.comf > file to enable ssl again? The "ssl" setting -- uncomment it and change it to "true" or "on", then restart the postmaster. See "Run-time Configuration" in the documentation for more information: http://www.postgresql.org/docs/8.0/interactive/runtime-config.html -- Michael Fuhr ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [GENERAL] missing FROM clause ?
Zlatko Matić wrote: Hello. In Postgres 8.1 I have a message that there is a missing FROM clause in the following query: select into l_validity "rok_valjanosti"."rok_valjanosti" FROM ( SELECT min("rok_valjanosti"."rv_id") AS "rv_id", "rok_valjanosti"."rok_valjanosti" FROM "rok_valjanosti" GROUP BY "rok_valjanosti"."rv_id", "rok_valjanosti"."rok_valjanosti") sve; If I change parameter "add missing from" in postgresl.conf to "on" than it works... I would like to include FROM clause, but can't see where. That subquery is called "sve" so I think you meant SELECT INTO l_validity svw.rok_valjanosti FROM ... -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] Why database is corrupted after re-booting
> If data on your disk gets corrupted then NOTHING can guarantee to recover > your database - not PG, not Firebird, not Oracle. Richard, thank you for reply. I ask my questing more presicely: I have configuration like in my previous message. Hardware (IDE drive, computer) and software (Windows XP) works according to vendor specifications. If I turn power off by breaking power cord when Postgres server is busy, is it possible that after that SELECT * FROM anytable does not work ? Andrus. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] Why database is corrupted after re-booting
On Thu, Oct 27, 2005 at 02:54:50PM +0300, Andrus wrote: > I have configuration like in my previous message. Hardware (IDE drive, > computer) and software (Windows XP) works according to vendor > specifications. > > If I turn power off by breaking power cord when Postgres server is busy, is > it possible that > after that SELECT * FROM anytable does not work ? Lets put it another way: 1. If you are only doing SELECTs the chance anything will go wrong is very small, because you're not actually writing anything. 2. If you are changing data and your disk faithfully and correctly writes that data in the order it's told, then PostgreSQL can use the WAL to recover, everything will work fine. 3. If your disk lies about writing data in the right order, 99% of the time you will be fine, but that one time your uber-important data is there, Murphy's law will kick in and trash it for you. I've run PostgreSQL on all sorts of hardware, some of it not very good and I've never lost any data or not had PostgreSQL come up properly afterwards. But I just consider myself lucky. I've been on this list long enough to see that bad things *do* happen with dodgy hardware. It doesn't go wrong often. Even then, it's usually a single block corrupted or an index that needs to be reindexed. Note: I've always run on Linux system, which provides POSIX type semantics for these things. I have *no* idea how much of this applies to Windows. Hope this helps, -- Martijn van Oosterhout http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them. pgplQ3h800i5K.pgp Description: PGP signature
Re: [GENERAL] Why database is corrupted after re-booting
Andrus wrote: If data on your disk gets corrupted then NOTHING can guarantee to recover your database - not PG, not Firebird, not Oracle. Richard, thank you for reply. I ask my questing more presicely: I have configuration like in my previous message. Hardware (IDE drive, computer) and software (Windows XP) works according to vendor specifications. If I turn power off by breaking power cord when Postgres server is busy, is it possible that after that SELECT * FROM anytable does not work ? It is always *possible*, but if your system isn't caching writes then it is *very very* unlikely. The tricky bit is that a lot of IDE drives don't really disable the write-cache. You should really test properly, but a quick way to know is to run a series of single inserts, each in their own transaction. If you get more transactions than the speed (rpm) of the disk then you know it *must* be caching. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] Why database is corrupted after re-booting
>> If I turn power off by breaking power cord when Postgres server is busy, >> is it possible that >> after that SELECT * FROM anytable does not work ? > > It is always *possible*, but if your system isn't caching writes then it > is *very very* unlikely. The tricky bit is that a lot of IDE drives don't > really disable the write-cache. > > You should really test properly, but a quick way to know is to run a > series of single inserts, each in their own transaction. If you get more > transactions than the speed (rpm) of the disk then you know it *must* be > caching. Richard, thank you. QUANTUM FIREPALLP LM20.5 is a widely used ATA IDE drive. Where do find information does it implement write caching properly or not ? Is there IDE drive compatibility list for Postgres ? If this information is not available is there a standard utility which can determine this drive compatibility with Postgres under Windows ? Is it possible write utility which converts corrupted database to readable state so that SELECT * FROM anytable will work always ? This utility may remove all contraints, just create database which contains as much data as possible. Then I can import this data to empty correct database and discard all rows which violate database rules. Andrus. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] Why database is corrupted after re-booting
Alex Stapleton <[EMAIL PROTECTED]> writes: > suspicion is that if the power failure isn't a particularly fast one, > (e.g. you overloaded a fuse somewhere, fuses are insanely slow to > fail compared to alternatives like MCBs) then your RAID card's RAM > will get corrupted as the voltage drops or the system memory will > resulting in bad data getting copied to the RAID controller as RAM > seems to be pretty sensitive to voltage variations in experiments > i've done on my insanely tweak-able desktop at home. I would of > though ECC probably helps, but it can only correct so much. Any competently designed battery-backup scheme has no problem with this. What can seriously fry your equipment is a spike (ie, too much voltage not too little). Most UPS-type equipment includes surge suppression hardware that offers a pretty good defense against this, but if you get a lightning strike directly where the power comes into your building, you're going to be having a chat with your insurance agent. There is nothing made that will withstand a point-blank strike. regards, tom lane ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [GENERAL] Need help with INOUT mis-understanding
> Probably not, if the way you seem to expect it to work is like Oracle. > An INOUT parameter isn't some sort of modifiable by-reference variable, > it's just a shorthand for declaring an IN parameter and an OUT > parameter. > Thanks for the response. That makes a lot of sense but I guess I was wishing to make it work in porting all the oracle pl/sql. If I have a function with 3 INOUTs and I get a return of (30,20,1) how should I structure it so I can read only the "1" from another function call? Should I be doing SETOF? I just haven't figured how to parse results within functions.. any suggestions for me? Thank you Troy ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [GENERAL] Why database is corrupted after re-booting
In article <[EMAIL PROTECTED]>, Welty, Richard <[EMAIL PROTECTED]> wrote: >crappy disk drives and bad windows file systems, nothing more. Could even be crappy memory. -- http://yosemitecampsites.com/ ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] Why database is corrupted after re-booting
On 27 Oct 2005, at 14:57, Tom Lane wrote: Alex Stapleton <[EMAIL PROTECTED]> writes: suspicion is that if the power failure isn't a particularly fast one, (e.g. you overloaded a fuse somewhere, fuses are insanely slow to fail compared to alternatives like MCBs) then your RAID card's RAM will get corrupted as the voltage drops or the system memory will resulting in bad data getting copied to the RAID controller as RAM seems to be pretty sensitive to voltage variations in experiments i've done on my insanely tweak-able desktop at home. I would of though ECC probably helps, but it can only correct so much. Any competently designed battery-backup scheme has no problem with this. What can seriously fry your equipment is a spike (ie, too much voltage not too little). Most UPS-type equipment includes surge suppression hardware that offers a pretty good defense against this, but if you get a lightning strike directly where the power comes into your building, you're going to be having a chat with your insurance agent. There is nothing made that will withstand a point-blank strike. The system RAM won't usually be supported by any batteries though, so it will go crazy, copy corrupt data to the DIMMs on the RAID controller, which then will refuse to write it to the disk until the power comes up, and then write the bad data to the drive surely? ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [GENERAL] Why database is corrupted after re-booting
Unless I missed something, I think you can select on a fresh install but not after. I doubt even an image could be switched but I could be wrong, I am too often. Troy ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] Need help with INOUT mis-understanding
Tom's right, As in the first message of this thread kindof shows; func2(INOUT) adds the var_1 to itself and ouputs back to func1 as the updated value. NOTICE: var_1 starts as 5 NOTICE: var_1 in func2 is 10 CONTEXT: PL/pgSQL function "func1" line 7 at assignment NOTICE: var_X Now is (10,5) --var_1 was 1st returned var So INOUTS "work" the way Tom says in PG8.1beta3 WIN XP The part I was confused about was that I thought that the value would then be modified in func1 (by func2) since it was returned using INOUT but Tom set me strait - INOUTS are nice 'shorthand'. (I waisted a lot of time not knowing this.) Thanks P.S. - Tom if the return of func2 = var_X = (10,5) how can I parse the varible out like: var_Y = var_X[1] -- first ARRAY item to get var_Y = 10? Troy H ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] Why database is corrupted after re-booting
Cheaper solution is to get a second hard drive an put it in your computer as a slave yes you could xcopy your drive to some backup device then repartition and plop it back - that would take alot of work and involves DiskCopy/Ghost like software and has great risk. (Run Defrag first - Plus you may still need dual partition the drive to put your boot files back in place.) Backup everything first! I don't know how much access you have, but another harddrive (100GB from bestbuy.com about $50 - cheaper that software. You could install a used, smaller hard drive and you'd never know the difference. Put just Postgres on the second hard drive (FORMAT IT NTFS FIRST). hope it helps Troy H ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq
Re: [GENERAL] Why database is corrupted after re-booting
I couldn't load it on a FAT32 partition on an XP HOME pc. So I loaded it on the NTSF partition of the same drive. I don't know why it did & now doesn't work but it could be that you need to defrag and clear some space. To change partition types you need to re-format (resetting partitions will lose data structure - reformat required). You could just pop in an additional harddrive (slave) and have it formatted NTFS - then install it on that drive D:/postgres/ Not the answer you'd want but good luck. Troy ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[GENERAL] pg_dump fails when it gets to table containing bytea
Could anyone suggest something that we can check to ascertain why pg_dumps fail? The pg_dump for our database just started to fail this week. Dumps of the same database succeeded just last week. Moreover, we can create a new database using the database (that we are trying to dump) as a template and the data is copied into the new database. We are getting the following error message whe we run “pg_dump -Ft > database.tar”: pg_dump: ERROR: canceling query due to user request pg_dump: SQL command to dump the contents of table "blob" failed: PQendcopy() fa iled. pg_dump: Error message from server: ERROR: canceling query due to user request pg_dump: The command was: COPY public.blob (prtnbr, bkey, bdsc, btypnbr, bcrtdte , bcrttme, bcrtusr, bflepath, bflenam, bfleext, bsetnbr, cblob) TO stdout;
Re: [GENERAL] Why database is corrupted after re-booting
Alex Stapleton <[EMAIL PROTECTED]> writes: > The system RAM won't usually be supported by any batteries though, so > it will go crazy, copy corrupt data to the DIMMs on the RAID > controller, which then will refuse to write it to the disk until the > power comes up, and then write the bad data to the drive surely? Not in competently designed hardware. The system should shut down completely the instant the power supply's outputs go out of spec, which will be before the logic components actually start to malfunction. This is not to say that cheap consumer-grade PCs are competently designed ;-) but the issue was a solved problem when I was a practicing EE, and that was a long time ago. regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] Need help with INOUT mis-understanding
"Troy" <[EMAIL PROTECTED]> writes: > P.S. - Tom if the return of func2 = var_X = (10,5) how can I parse the > varible out like: > var_Y = var_X[1] -- first ARRAY item > to get var_Y = 10? Try assigning the function result to a RECORD variable, perhaps SELECT * INTO rec FROM foo(...); Then you can access the record variable's fields. regards, tom lane ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [GENERAL] Why database is corrupted after re-booting
On 27 Oct 2005, at 16:07, Tom Lane wrote: Alex Stapleton <[EMAIL PROTECTED]> writes: The system RAM won't usually be supported by any batteries though, so it will go crazy, copy corrupt data to the DIMMs on the RAID controller, which then will refuse to write it to the disk until the power comes up, and then write the bad data to the drive surely? Not in competently designed hardware. The system should shut down completely the instant the power supply's outputs go out of spec, which will be before the logic components actually start to malfunction. This is not to say that cheap consumer-grade PCs are competently designed ;-) but the issue was a solved problem when I was a practicing EE, and that was a long time ago. lol, iirc it was an middle aged piece of random dell equipment. They seem to be getting progressively less awful these days so maybe it was just that particular model. I may have to do some evil tests using glass fuses and hammers (and rubber gloves)... ---(end of broadcast)--- TIP 6: explain analyze is your friend
Re: [GENERAL] pg_dump fails when it gets to table containing bytea
"Carlos Oliva" <[EMAIL PROTECTED]> writes: > We are getting the following error message whe we run "pg_dump -Ft name> > database.tar": > pg_dump: ERROR: canceling query due to user request This implies that something sent SIGINT to the backend process. We've heard some reports that suggest that some platforms send SIGINT when a soft resource consumption limit is hit (too much process runtime or I/O or something). Look around for something of that description, particularly if the limit settings were changed recently. regards, tom lane ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] Why database is corrupted after re-booting
Andrus wrote: QUANTUM FIREPALLP LM20.5 is a widely used ATA IDE drive. Where do find information does it implement write caching properly or not ? I don't think the manufacturers bother to make this sort of information available. Is there IDE drive compatibility list for Postgres ? No - for the reason above (amongst oghers). If this information is not available is there a standard utility which can determine this drive compatibility with Postgres under Windows ? Try the test I described earlier. Is it possible write utility which converts corrupted database to readable state so that SELECT * FROM anytable will work always ? This utility may remove all contraints, just create database which contains as much data as possible. Then I can import this data to empty correct database and discard all rows which violate database rules. There's nothing I know of, and I don't think we see enough problems to build anything very sophisticated. There is a file-dump utility from Red Hat: http://sources.redhat.com/rhdb/ Far better is to always have a known-good version on the machine. Have a look in the manuals for Point-in-time recovery (PITR). That might suit your needs. It also would let you re-run changes to any point in the day - useful for clients who delete things they shouldn't! -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] pg_dump fails when it gets to table containing bytea
Is your table really named "blob" ??? You said it fails when it gets to the table named "blob" not somewhere in the process of dumping the table "blob"... There might be a clue in that... What happens if yo rename the table to something other than an SQL reserverd word ? Although postgreSQL doesn't have a data type of "blob" (many other RDBMS's do, including blob and clob), there's a chance that the word "blob" is used internally by postgreSQL for historical purposes >From section 8.1 (Data Types) of the manual there is a possibility that "blob" is an alias used internally by postgreSQL Table 8.1, "Data Types" shows all built-in general-purpose data types. Most of the alternative names listed in the "Aliases" column are the names used internally by PostgreSQL for historical reasons. In addition, some internally used or deprecated types are available, but they are not listed here. ""Carlos Oliva"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Could anyone suggest something that we can check to ascertain why pg_dumps fail? The pg_dump for our database just started to fail this week. Dumps of the same database succeeded just last week. Moreover, we can create a new database using the database (that we are trying to dump) as a template and the data is copied into the new database. We are getting the following error message whe we run "pg_dump -Ft > database.tar": pg_dump: ERROR: canceling query due to user request pg_dump: SQL command to dump the contents of table "blob" failed: PQendcopy() fa iled. pg_dump: Error message from server: ERROR: canceling query due to user request pg_dump: The command was: COPY public.blob (prtnbr, bkey, bdsc, btypnbr, bcrtdte , bcrttme, bcrtusr, bflepath, bflenam, bfleext, bsetnbr, cblob) TO stdout; ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] SHA1 authentication
On Mon, Oct 24, 2005 at 11:33:50 +0200, Martijn van Oosterhout wrote: > > By all means, submit a patch but there's no real hurry right now. We > should probably move straight to something more secure anyway, maybe > SHA-256 or something. This makes more sense. There is little point in going to the effort to changing to SHA-1 only to change again later. There isn't any hurry to change now, so it might be better to wait until the next group of hash functions is designed, built on lessons learned from the attacks against MD5 and SHA-1. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org
Re: [GENERAL] improve 'where not exists' query..
I've created an index on contacts.cempid (I'd not even checked whether one existed); and the query is certainly improved. I'm wondering..I get the impression that the hash index is ideal in this case, technically, because I only intend to query with '='; but the btree index is a bit faster. I'll need to look further into that.. Thank you for the input on this. - NoelOn 10/27/05, Richard Huxtonwrote: Noel Whelan wrote:> I executed the following:>> EXPLAIN ANALYZE SELECT cwit.cempid> FROM "cwItems" cwit> WHERE (NOT (EXISTS (SELECT con.cempid> FROM contacts con> WHERE ( con.cempid = cwit.cempid;>> It comes back with:>> Seq Scan on "cwItems" cwit (cost=0.00..8929702.11 rows=5132 width=8) (actual> time=132218.29..148623.27 rows=31 loops=1) > Filter: (NOT (subplan))> SubPlan> -> Seq Scan on contacts con (cost=0.00..870.77 rows=1 width=8) (actual time=> 11.82..11.82 rows=1 loops=12528)> Filter: (cempid = $0)> Total runtime: 148623.54 msec>> I'm not certain it's an issue with the query itself going wrong. I consider> I'm basically telling it: for each cempid in 'cwItems', check whether or not> it exists as a cempid in 'contacts', which could be inherently inefficient > in itself.Well, as you say it's never going to be possible without checking allitems. However, you've got two seq-scans there and I'd expect a seq-scanand looping over an index (or a hash-based plan perhaps). Now, looking at the values it's only seeing 31 rows in cwItems and 1 row(!) in contacts, so that would explain the scans. However, in that caseI'd expect it to be much faster than it is.Hmm - I'd take the following steps: 1. VACUUM FULL VERBOSE ANALYSE on both those tables and then seewhat happens. Make a note of how many removable/non-removable rows itfinds. Rerun the explain analyse and see what happens. 2. Check that you have an index on contact.cempid and that the types ofcempid match in both tables. Then issue "SET enable_seqscan=true" andrun the explain analyse again - are things faster?Let us know what happens, oh and don't forget to cc: the list, you were lucky I read this.> I just wondered if there'd be a way to improve on it or not.> Installation is postgres-7.3.4.Upgrade to the latest 7.3.x version as soon as is convenient - lots ofbug fixes to be had. -- Richard Huxton Archonet Ltd
Re: [GENERAL] alt+F not working after calling pg_dump
> .. and also > what happens if you just call a bat-file that does nothing and then > exits. After running bat file containing single line exit Alt+F key works. After running bat file containg 3 lines set pgpassword=x C:\PROGRA~1\POSTGR~1\8.0\PGADMI~1\pg_dump.exe -Z9 -b -v -f "I:\051027 DEMO backup.backup" -F c -h andrus -U postgres mydb exit Alt+F does not work. So it seems that pg_dump.exe code causes Alt+F not working. Andrus. ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
[GENERAL] Connections to DB
Title: Connections to DB How can I view the current, persistent connections to a database? Is there a way to do this with 'psql' or with some other PostgreSQL bundled tool/utility (~pgsql_directory/bin), instead of resorting to the underlying operating system commands (ie: netstat -a | grep postgres)? I am interested in finding out the following: 1) How many connections are there to the database? 2) How long have they persisted? 3) What is the idle time of the connections? Any help would be appreciated. Thanks! - Onyx --- Onyx Mueller Software Engineer i-cubed : information integration & imaging LLC 201 Linden Street : Third Floor Fort Collins, CO 80524 970-482-4400 voice 970-482-4499 fax www.i3.com
Re: [GENERAL] Connections to DB
SELECT * FROM pg_stat_activity; Note that if you turn on stats_command_string you'll also be able to see what each connection is doing if you're connected as a superuser. On Thu, Oct 27, 2005 at 11:21:26AM -0600, Onyx wrote: > How can I view the current, persistent connections to a database? Is there > a way to do this with 'psql' or with some other PostgreSQL bundled > tool/utility (~pgsql_directory/bin), instead of resorting to the underlying > operating system commands (ie: netstat -a | grep postgres)? > > I am interested in finding out the following: 1) How many connections are > there to the database? 2) How long have they persisted? 3) What is the > idle time of the connections? > > Any help would be appreciated. Thanks! > > > - Onyx > --- > Onyx Mueller > Software Engineer > i-cubed : information integration & imaging LLC > 201 Linden Street : Third Floor > Fort Collins, CO 80524 > 970-482-4400 voice > 970-482-4499 fax > www.i3.com > > -- Jim C. Nasby, Sr. Engineering Consultant [EMAIL PROTECTED] Pervasive Software http://pervasive.comwork: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461 ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
[GENERAL] aix build question re: duplicate symbol warning
Hi all, I'm trying to build PG 8.1 beta on an AIX server. The 'make' finishes without errors, but I'm getting lots of duplicate symbol warnings like the following one. What am I to make of these? gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -fno-strict-aliasing -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE -o libpq.\ so libpq.a -L../../../src/port-L../../../src/port -lnsl -Wl,-bI:../../../src/backend/postgres.imp -Wl,-bE:libpq.exp ld: 0711-224 WARNING: Duplicate symbol: .pqStrerror ld: 0711-224 WARNING: Duplicate symbol: .pqGetpwuid ... I used a vanilla configure except for --without-readline. Tools that seem to be in use: AIX 5.1 GNU Make 3.80 gcc 3.2.2 ld - AIX version This is an 8-CPU machine that recently became disused in our research department and looks like a nice potential PG host. Thanks, Kevin Murphy ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] aix build question re: duplicate symbol warning
Kevin Murphy <[EMAIL PROTECTED]> writes: > I'm trying to build PG 8.1 beta on an AIX server. > The 'make' finishes without errors, but I'm getting lots of duplicate > symbol warnings like the following one. What am I to make of these? > gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline > -fno-strict-aliasing -Wl,-bnoentry -Wl,-H512 -Wl,-bM:SRE -o libpq.\ > so libpq.a -L../../../src/port-L../../../src/port -lnsl > -Wl,-bI:../../../src/backend/postgres.imp -Wl,-bE:libpq.exp > ld: 0711-224 WARNING: Duplicate symbol: > .pqStrerror Hmm. pqStrerror is defined in libpgport (which is linked into the backend) as well as libpq. ISTM that libpq should not be linked with -Wl,-bI:../../../src/backend/postgres.imp, since it's not intended to be loaded into the backend. Without having looked at the code, I'm wondering if the AIX makefiles stick that option into LDFLAGS_SL rather than someplace more restricted. regards, tom lane ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] Why database is corrupted after re-booting
Actually, because I lost several thousands of dollars or equipement a couple of years ago, I recommended these "brickwall" products to a company. http://brickwall.com/index.htm We actually never deployed these units (grounding the communications lines ended up being a much cheaper solution) but I did talk and engineer at the company and apparently they have some hospitals as client that use unitss. I'm won't get into the technology of how they work since you can read that yourself but I remember having a warm and fuzzy after my conversation. I will pull one quote from their web site though... "Unlike MOVs, TRANS-ZORBS and similar shunt based surge protectors that use elements weighing less than 1/4 ounce, Brick Wall surge protectors can easily absorb any surge repeatedly with absolutely no degradation." The important phrase here is "...absorb any surge repeatedly with absolutely no degradation." Quoting Tom Lane <[EMAIL PROTECTED]>: > Alex Stapleton <[EMAIL PROTECTED]> writes: > > suspicion is that if the power failure isn't a particularly fast one, > > (e.g. you overloaded a fuse somewhere, fuses are insanely slow to > > fail compared to alternatives like MCBs) then your RAID card's RAM > > will get corrupted as the voltage drops or the system memory will > > resulting in bad data getting copied to the RAID controller as RAM > > seems to be pretty sensitive to voltage variations in experiments > > i've done on my insanely tweak-able desktop at home. I would of > > though ECC probably helps, but it can only correct so much. > > Any competently designed battery-backup scheme has no problem with this. > > What can seriously fry your equipment is a spike (ie, too much voltage > not too little). Most UPS-type equipment includes surge suppression > hardware that offers a pretty good defense against this, but if you get > a lightning strike directly where the power comes into your building, > you're going to be having a chat with your insurance agent. There is > nothing made that will withstand a point-blank strike. > > regards, tom lane > > ---(end of broadcast)--- > TIP 1: if posting/reading through Usenet, please send an appropriate >subscribe-nomail command to [EMAIL PROTECTED] so that your >message can get through to the mailing list cleanly > -- Keith C. Perry, MS E.E. Director of Networks & Applications VCSN, Inc. http://vcsn.com This email account is being host by: VCSN, Inc : http://vcsn.com ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] SHA1 authentication
On 10/27/05, Bruno Wolff III <[EMAIL PROTECTED]> wrote: On Mon, Oct 24, 2005 at 11:33:50 +0200, Martijn van Oosterhoutwrote:>> By all means, submit a patch but there's no real hurry right now. We > should probably move straight to something more secure anyway, maybe> SHA-256 or something.This makes more sense. There is little point in going to the effort tochanging to SHA-1 only to change again later. There isn't any hurry to change now, so it might be better to wait untilthe next group of hash functions is designed, built on lessons learned fromthe attacks against MD5 and SHA-1. It might be a good step to go through and figure out what needs to be changed, then implement a plugin type system to reduce the need for changes when the next generation of hashes gets "broken". It might even allow for authentication to external sources, like LDAP or some other plugin.
Re: [GENERAL] Why database is corrupted after re-booting
On Thu, 2005-10-27 at 15:14, Keith C. Perry wrote: > Actually, because I lost several thousands of dollars or equipement a couple > of > years ago, I recommended these "brickwall" products to a company. > > http://brickwall.com/index.htm > > We actually never deployed these units (grounding the communications lines > ended > up being a much cheaper solution) but I did talk and engineer at the company > and > apparently they have some hospitals as client that use unitss. I'm won't get > into the technology of how they work since you can read that yourself but I > remember having a warm and fuzzy after my conversation. > > I will pull one quote from their web site though... > > "Unlike MOV’s, TRANS-ZORBS and similar shunt based surge protectors that use > elements weighing less than 1/4 ounce, Brick Wall surge protectors can easily > absorb any surge repeatedly with absolutely no degradation." > > The important phrase here is "...absorb any surge repeatedly with absolutely > no > degradation." Having worked on stuff with some massive surge protectors, I'd say that surge protectors in a Radio Shack (or any other store) are like having an umbrella compared to a regular rain storm. The higher end stuff, up through this brick wall, are kind of like variously well built buildings and storm cellers against increasingly nasty storms. And lastly, there's the direct lightening strike. Which fries everything within a certain radius. It's equivalent to a tornado touching down exactly against your storm cellar, and maybe even dropping a locomotive right through the entrance as well. And if that's not enough, there's always a meteor strike to ruin your day. Don't get me wrong, I'm all for protection, I've just come to realize that everything is in shades of grey. But I do agree that those MOV based surge protectors are pretty much worthless, like bows and arrows agains the lightening (it's a cloudy, stormy day here in Chicago, what can I say...) ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings
Re: [GENERAL] copy data from utf16 csv file
On Thu, Oct 27, 2005 at 03:30:43PM -0700, Shane wrote: > > Can anyone suggest how I can either get these into PG directly > or massage the file so as to be compatable? To my knowledge the only Unicode encoding used by Postgres is utf-8. Try 'recode' or 'iconv' on unix-like systems. A better text editor can convert on MS Windows. Peter ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
Re: [GENERAL] Why database is corrupted after re-booting
w_tom wrote: Series mode protector will ignore or avoid THE one and essential component of an effective protection system - single point earth ground. Indeed. And yes, a high end data center should survive a lightning strike (as well as hospital's power systems, etc). Here's a nice article where Suncoast Schools Federal Credit Union's data center survived a direct lightning strike to their 480-V service entrance cable. The article spends a lot of the time talking about the grounding system. http://www.ecpzone.com/article/article.jsp?siteSection=12&id=41 "Starting from the ground up, the main elements of the [lightning protection] system...include: (1) Three 20-ft x 5/8-in (6-m x 16-mm) copper-clad-steel grounding electrodes [...] The grounding system's resistance to earth as measured by fall-of-potential testing is 4.3 ohms. (2) Another 4/0 copper grounding conductor connects the ground-neutral bus in the service entrance panel to the ground bus in a 480-V distribution panel ... (3) Multiple uninterruptible power supplies (UPSs) (4) Up to seven layers of voltage surge protection High Quality Grounding "even the most expensive TVSS you can buy is absolutely useless unless it sees a high-quality, low-resistance ground. " " ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings