Re: [GENERAL] Strange Postgresql behavior solved
On Saturday 26. July 2008, Owen Hartnett wrote: Probably some funky stuff with the router (not one of their expensive ones) that caused all the consternation, but I originally thought corrupt database (because I could get 117 records to come out fine, but not the 118th). Also, I had narrowed it down to failing only when accessing the last three fields of that 118th record, the first 40 fields were fine. That sounds a lot like the game mode router bug: http://www.azureuswiki.com/index.php/Torrents_stop_at_99_percent -- Leif Biberg Kristensen | Registered Linux User #338009 Me And My Database: http://solumslekt.org/blog/ My Jazz Jukebox: http://www.last.fm/user/leifbk/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user
Zoltan Boszormenyi írta: Joshua D. Drake írta: On Fri, 2008-07-25 at 22:39 +0200, Zoltan Boszormenyi wrote: Hi, is there anyone using PostgreSQL on FreeBSD 7.0 starting from scratch? I compiled 8.3.3 and wanted to run initdb in my home directory but it fails with the error below. I configured the shared memory settings in advance according to the PostgreSQL 8.3 online docs: $ cat /etc/sysctl.conf ... kern.ipc.shmall=32768 kern.ipc.shmmax=134217728 kern.ipc.semmap=256 These three settings were also set with sysctl -w ... to take effect immediately. Are you buy chance in a jail? Joshua D. Drake I don't know. How to determine? Running this as my own user: $ sysctl -a | grep ^kern.ipc shows the same settings as above. Thanks. Rebooting FreeBSD solved it. Huh? Is it really like W#@$#? Anyway, thanks for the help. -- -- Zoltán Böszörményi Cybertec Schönig Schönig GmbH http://www.postgresql.at/ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] php + postgresql
Hi, Aarni Ruuhimäki wrote: On Friday 25 July 2008 15:33, you wrote: I would avoid that in favour of using $HOME/.pgpass http://www.postgresql.org/docs/8.1/interactive/libpq-pgpass.html HTH Tino Hi, Quite right you are. Or something like this? require(/eg/unknown_path/deep_somewhere_else/dbconnect_app_name.php) Well this would be reinventing the wheel and also can really cause accidently checking that into your version control system which should be avoided for credentials holding files. T. smime.p7s Description: S/MIME Cryptographic Signature
Re: [GENERAL] php + postgresql
Joshua D. Drake wrote: On Sat, 2008-07-26 at 11:13 +0930, admin wrote: Anyway, while I'm quite happy to continue banging out things that just work in PHP for the time being, you suggest (in a subsequent post) that there is one scripting language in particular that you'd use ... might I enquire which language that is, and why? Just curious, I'm definitely not looking for an ideological debate. You do realize that you just opened one of the longest, loudest and most inherently beer inducing arguments known to man since Emacs vs Vi? (answer: Joe) So why not! I use Python. I love Python. Although I guarantee you that others will say ruby, perl, java (well maybe not java). I'd say python too but I intentionally left that out in the discussion just to avoid that usual foo vs. bar discussion which isn't to win. The answer to your question is: Use what works for you. But this might as well include that you know if that really works for you instead of beeing something that you stumble over and hope it will work (because it seems to work for so many others) I used PHP for years, I actually used Perl before PHP but got tired of the Perl oddness. I moved on to Python and love it. There are things in it I don't like (just see subprocess) but for the most part, its gorgeous. Yeah, I used C (for the web), i tried perl and came to python. Whenever I checked PHP I found it so bad designed (if at all) that it really hurted. And occassionally I'm asked for help on PHP questions so I see nothing essentially has changed on the matters for the last 10 years. Its still confusing naming of functions (hello namespaces), not really a type system (think '1' + 2 ) and the like. PHP5 didn't change much because if you want to adopt OOP you could as well just use a language which does this for years (even Ecmascript) or - as most seem to do - just continue to code old style. This horrible mixing of code and HTML is even found in JSP code these days. T. smime.p7s Description: S/MIME Cryptographic Signature
Re: [GENERAL] php + postgresql
Leif B. Kristensen wrote: On Friday 25. July 2008, Christophe wrote: ... My 2 cents: The prime reason for the popularity of PHP is probably the very gentle learning curve. You can start with a static HTML page, and introduce a few PHP snippets to show dynamic content. For us self-taught people, that means that you get instant results with minimal work. Seems you never used a decent template engine, such as TAL http://www.owlfish.com/software/simpleTAL/tal-guide.html Which really is code by example instead of intermixing language constructs with HTML which is incredibly hard to maintain. If any language want to compete with PHP in popularity, I believe that it must be just as easy to mingle with HTML. $DEITY, I would love to be able to include Perl code in a HTML page inside a pair of ?pl and ? tags. Most if not all other languages which are used for the web do have those ways, which does not mean its recommended to do so. Now, I don't write PHP scripts like that anymore. I like to have every single character served as HTML to be generated by a function. And I Which is for sure very performant ;) realize that Perl would do that even better than PHP. But as I have become quite proficient with PHP, I tend to keep using that. It surely does the job. And hope that you arent bitten by nasty bugs in the language implementation or your security configuration of it :-) Ok, enough PHP bashing. Sun is shining here and so I invite everybody to enjoy the weekend :-) T. smime.p7s Description: S/MIME Cryptographic Signature
Re: [GENERAL] php + postgresql
On Fri, Jul 25, 2008 at 4:29 PM, Bill Wordsworth [EMAIL PROTECTED] wrote: years. It is newbies like him and fan-boys of Ruby/Python/Perl who give PHP a bad name. But I fail to understand the little animosity within some PostgreSQL users to PHP- is it the LAMP stack? On Fri, Jul 25, 2008 at 4:59 PM, Scott Marlowe [EMAIL PROTECTED] wrote: I too don't get the animosity. it's not like you can't write bad code in perl, java, ruby or python. The real issue is the quality of the programmer. On Sat, Jul 26, 2008 at 1:43 AM, admin [EMAIL PROTECTED] wrote: Re the possible heightened level of animosity to PHP in PG circles, if it exists, could it have anything to do with PHP's close association with MySql? The animosity, by the way, seems to go both ways, I think I saw something about Rasmus Lerdorf bagging PostgreSQL on Slashdot(?) recently. Yes let's stop bluffing and come out with the *real* reason: PHP/Zend better support MySQL and both have scratched each others back via the famous LAMP stack. But instead of thinking of better ways for cooperation, this has caused certain jealousy in some circles, something like But I am so much better and so I should have enjoyed that fame. This is not fair!. And *that* is the real reason why any question on PHP on this list never goes without a shot at PHP. PHP is faster than Python, has a smaller memory foot-print than Python, has better SOAP features than Python, and is better suited for the web than Python. Python is better suited for the cli/mac/desktop/phone. And nobody made Engineers the boss of us. We also can't compare Database v Language, that MySQL = PHP where PostgreSQL = Language of Your Choice. We can like PHP *and* PostgreSQL and stand up for both. Cheers, Bill On Sat, Jul 26, 2008 at 11:28 AM, Tino Wildenhain [EMAIL PROTECTED] wrote: Leif B. Kristensen wrote: On Friday 25. July 2008, Christophe wrote: ... My 2 cents: The prime reason for the popularity of PHP is probably the very gentle learning curve. You can start with a static HTML page, and introduce a few PHP snippets to show dynamic content. For us self-taught people, that means that you get instant results with minimal work. Seems you never used a decent template engine, such as TAL http://www.owlfish.com/software/simpleTAL/tal-guide.html Which really is code by example instead of intermixing language constructs with HTML which is incredibly hard to maintain. If any language want to compete with PHP in popularity, I believe that it must be just as easy to mingle with HTML. $DEITY, I would love to be able to include Perl code in a HTML page inside a pair of ?pl and ? tags. Most if not all other languages which are used for the web do have those ways, which does not mean its recommended to do so. Now, I don't write PHP scripts like that anymore. I like to have every single character served as HTML to be generated by a function. And I Which is for sure very performant ;) realize that Perl would do that even better than PHP. But as I have become quite proficient with PHP, I tend to keep using that. It surely does the job. And hope that you arent bitten by nasty bugs in the language implementation or your security configuration of it :-) Ok, enough PHP bashing. Sun is shining here and so I invite everybody to enjoy the weekend :-) T. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Wrapper to use correct version of psql?
I have a bunch of different version of postgresql installed, from 7.0 on forward, on various servers. As psql is fairly version specific, and tends to misbehave if the client and server versions don't match, I usually need to remember which version is running on which machine and port. The obvious thing to do is write a wrapper that will transparently run the right version of psql for the database it's connecting to. Has anyone already done that? Cheers, Steve -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Strange Postgresql behavior solved
On Jul 26, 2008, at 2:32 AM, Leif B. Kristensen [EMAIL PROTECTED] wrote: On Saturday 26. July 2008, Owen Hartnett wrote: Probably some funky stuff with the router (not one of their expensive ones) that caused all the consternation, but I originally thought corrupt database (because I could get 117 records to come out fine, but not the 118th). Also, I had narrowed it down to failing only when accessing the last three fields of that 118th record, the first 40 fields were fine. That sounds a lot like the game mode router bug: http://www.azureuswiki.com/index.php/Torrents_stop_at_99_percent Yes. It looks like just the behavior. The read failed in the exact same record every time, even at the same column, and the server is sitting in a DMZ. -Owen -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] how to remove the duplicate elements from an array?
hi all: if I create an array '{44,55,66,c4,55,66,b4,55,66}', how to remove the duplicate elements(55, 66) from it, after remove, the array will be '{44,55,66,c4,b4}' thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Casting composite types
Using 8.1 # create table foo (a integer, b integer); # create table baz (b integer, c integer); # insert into foo values (8,9); # insert into baz values (9,1); # select * from foo; a | b ---+--- 8 | 9 (1 row) # select * from baz; b | c ---+--- 9 | 1 (1 row) # create view foobaz as select foo.*, baz.c from foo join baz using (b); # select * from foobaz; a | b | c ---+---+--- 8 | 9 | 1 (1 row) So far so good. I have many functions that take the composite type foo, and therefore wish to be able to cast a foobaz into a foo, by taking only columns in foo (i.e. a and b). But of course there's no cast defined: # select foobaz::foo from foobaz; ERROR: cannot cast type foobaz to foo # select foo(foobaz) from foobaz; ERROR: function foo(foobaz) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. Ideally, I'd love to avoid writing a separate function for each foo,baz pair of types as I have many of each. In any case, I want to avoid specifying the columns of foo in the code of foo(foobaz) so that the function doesn't break when I alter the foo table. The best I've got for the latter is: CREATE OR REPLACE FUNCTION foo(foobaz) RETURNS foo AS $$ my ($foobaz) = @_; my $foo = {}; $row = spi_fetchrow(spi_query(SELECT * from foo limit 1)); for (keys %$row) {$foo-{$_} = $foobaz-{$_}}; return $foo; $$ LANGUAGE plperlu; which feels very cumbersome, but works, provided foo is not empty. # select foo(foobaz) from foobaz; foo --- (8,9) (1 row) Am I missing an obvious trick or syntax here for such an 'autocast'? Or have I just been corrupted by Perl to take types too lightly? Thanks Julian -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] how to remove the duplicate elements from an array?
hello try create function uniq(anyarray) returns anyarray as $$ select array(select distinct $1[i] from generate_series(array_lower($1,1), array_upper($1,1)) g(i)); $$ language sql strict immutable; postgres=# select uniq(array[1,2,3,1,2,3,5,2,2]); uniq --- {1,2,3,5} (1 row) regards Pavel Stehule 2008/7/26 Yi Zhao [EMAIL PROTECTED]: hi all: if I create an array '{44,55,66,c4,55,66,b4,55,66}', how to remove the duplicate elements(55, 66) from it, after remove, the array will be '{44,55,66,c4,b4}' thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
On Wed, 23 Jul 2008, Andrej Ricnik-Bay wrote: Now there's an interesting piece of information :) How long ago did you upgrade it? Andrej, I found the thread in the archives for June of this year. Re-reading the posted results of running initdb I tried a different approach to starting the server. Instead of using pg_ctl I used 'postgres -D /var/lib/pgsql/data ' (while logged in as user postgres, of course.) That cleaned up a bad shutdown (when I had to reboot the system after it hung), fixed the missing socket, and replaced the .pid. So, it's up and running once again. My question is how best to modify the startup script so the postmaster fires up when the system is rebooted. I don't see an option to 'su' to specify the postgres user's password so I can script this. Have you any recommendation? Thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] php + postgresql
Bill Wordsworth wrote: ... PHP is faster than Python, has a smaller memory foot-print than Python, has better SOAP features than Python, and is better suited for the web than Python. Python is better suited for the cli/mac/desktop/phone. Do you have proof for that? Or is this similar to MySQL is faster then Postgresql? I see a different picture: http://shootout.alioth.debian.org/debian/benchmark.php?test=alllang=pythonlang2=php And nobody made Engineers the boss of us. We also can't compare Database v Language, that MySQL = PHP where PostgreSQL = Language of Your Choice. We can like PHP *and* PostgreSQL and stand up for both. Cheers, Bill Oh, we can do that exactly the same way as someone can stand up for a ... err.. whatever language ;-) T. smime.p7s Description: S/MIME Cryptographic Signature
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
On 27/07/2008, Rich Shepard [EMAIL PROTECTED] wrote: Andrej, Hi Rich, I found the thread in the archives for June of this year. Re-reading the posted results of running initdb I tried a different approach to starting the server. Instead of using pg_ctl I used 'postgres -D /var/lib/pgsql/data ' (while logged in as user postgres, of course.) That cleaned up a bad shutdown (when I had to reboot the system after it hung), fixed the missing socket, and replaced the .pid. So, it's up and running once again. My question is how best to modify the startup script so the postmaster fires up when the system is rebooted. I don't see an option to 'su' to specify the postgres user's password so I can script this. Have you any recommendation? Since Slackware doesn't use the SysV style of inits but default the easiest way for you to achieve an automatic start-up of postgres on reboot would be to add something like if [ -x /etc/rc.d/rc.postgres ]; then /etc/rc.d/rc.postgres start fi to your /etc/rc.d/rc.local Thanks, Rich Cheers, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
Rich Shepard [EMAIL PROTECTED] writes: My question is how best to modify the startup script so the postmaster fires up when the system is rebooted. I don't see an option to 'su' to specify the postgres user's password so I can script this. Startup scripts invariably run as root, so 'su' isn't going to ask for a password... regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] php + postgresql
Tino Wildenhain wrote: Bill Wordsworth wrote: ... PHP is faster than Python, has a smaller memory foot-print than Python, has better SOAP features than Python, and is better suited for the web than Python. Python is better suited for the cli/mac/desktop/phone. Do you have proof for that? Or is this similar to MySQL is faster then Postgresql? I can't say that I am getting the same high off the drug Bill is using. PHP may be faster in some circumstances (I really can't say) but better SOAP features? Highly doubtful. Not to mention nice little things like REST. But then again, this wasn't supposed to be a PHP vs everybody thread. I find it interesting that Bill is being so negative. Most of the people on the thread have just pointed out, specific issues with PHP that Python (or insert other language here) does not have. Sincerely, Joshua D. Drake -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] how to remove the duplicate elements from an array?
yes, it's work. thank u very much! Regards Yi On Sat, 2008-07-26 at 21:37 +0200, Pavel Stehule wrote: hello try create function uniq(anyarray) returns anyarray as $$ select array(select distinct $1[i] from generate_series(array_lower($1,1), array_upper($1,1)) g(i)); $$ language sql strict immutable; postgres=# select uniq(array[1,2,3,1,2,3,5,2,2]); uniq --- {1,2,3,5} (1 row) regards Pavel Stehule 2008/7/26 Yi Zhao [EMAIL PROTECTED]: hi all: if I create an array '{44,55,66,c4,55,66,b4,55,66}', how to remove the duplicate elements(55, 66) from it, after remove, the array will be '{44,55,66,c4,b4}' thanks. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
On 27/07/2008, Tom Lane [EMAIL PROTECTED] wrote: Startup scripts invariably run as root, so 'su' isn't going to ask for a password... And it's nothing to worry about because the script he's using is suing to the postgres user anyway ... regards, tom lane Cheerw, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] procedure to load xml file data in postgesql
Hello, I have to load xml file data into postgresql database table using a stored procedure,but I didn't have any idea how to start it.Can you please help me how to do this.Your suggestion is greatly appreciated.Its very important to me. Thanks in advance, Avin. ?xml version=1.0? catalog book id=bk101 authorGambardella, Matthew/author titleXML Developer's Guide/title genreComputer/genre price44.95/price publish_date2000-10-01/publish_date descriptionAn in-depth look at creating applications with XML./description /book book id=bk102 authorRalls, Kim/author titleMidnight Rain/title genreFantasy/genre price5.95/price publish_date2000-12-16/publish_date descriptionA former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world./description /book book id=bk103 authorCorets, Eva/author titleMaeve Ascendant/title genreFantasy/genre price5.95/price publish_date2000-11-17/publish_date descriptionAfter the collapse of a nanotechnology society in England, the young survivors lay the foundation for a new society./description /book book id=bk104 authorCorets, Eva/author titleOberon's Legacy/title genreFantasy/genre price5.95/price publish_date2001-03-10/publish_date descriptionIn post-apocalypse England, the mysterious agent known only as Oberon helps to create a new life for the inhabitants of London. Sequel to Maeve Ascendant./description /book book id=bk105 authorCorets, Eva/author titleThe Sundered Grail/title genreFantasy/genre price5.95/price publish_date2001-09-10/publish_date descriptionThe two daughters of Maeve, half-sisters, battle one another for control of England. Sequel to Oberon's Legacy./description /book book id=bk106 authorRandall, Cynthia/author titleLover Birds/title genreRomance/genre price4.95/price publish_date2000-09-02/publish_date descriptionWhen Carla meets Paul at an ornithology conference, tempers fly as feathers get ruffled./description /book book id=bk107 authorThurman, Paula/author titleSplish Splash/title genreRomance/genre price4.95/price publish_date2000-11-02/publish_date descriptionA deep sea diver finds true love twenty thousand leagues beneath the sea./description /book book id=bk108 authorKnorr, Stefan/author titleCreepy Crawlies/title genreHorror/genre price4.95/price publish_date2000-12-06/publish_date descriptionAn anthology of horror stories about roaches, centipedes, scorpions and other insects./description /book book id=bk109 authorKress, Peter/author titleParadox Lost/title genreScience Fiction/genre price6.95/price publish_date2000-11-02/publish_date descriptionAfter an inadvertant trip through a Heisenberg Uncertainty Device, James Salway discovers the problems of being quantum./description /book book id=bk110 authorO'Brien, Tim/author titleMicrosoft .NET: The Programming Bible/title genreComputer/genre price36.95/price publish_date2000-12-09/publish_date descriptionMicrosoft's .NET initiative is explored in detail in this deep programmer's reference./description /book book id=bk111 authorO'Brien, Tim/author titleMSXML3: A Comprehensive Guide/title genreComputer/genre price36.95/price publish_date2000-12-01/publish_date descriptionThe Microsoft MSXML3 parser is covered in detail, with attention to XML DOM interfaces, XSLT processing, SAX and more./description /book book id=bk112 authorGalos, Mike/author titleVisual Studio 7: A Comprehensive Guide/title genreComputer/genre price49.95/price publish_date2001-04-16/publish_date descriptionMicrosoft Visual Studio 7 is explored in depth, looking at how Visual Basic, Visual C++, C#, and ASP+ are integrated into a comprehensive development environment./description /book /catalog -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
On Sun, 27 Jul 2008, Andrej Ricnik-Bay wrote: if [ -x /etc/rc.d/rc.postgres ]; then /etc/rc.d/rc.postgres start fi to your /etc/rc.d/rc.local Well, that's the problem, Andrej. I have that script, and it worked fine with postgres-6.x through -8.1, but failed to correctly start the postmaster after the system reboot. I can try twiddling with the script; it calls pg_ctl, and that should work, but apparently something broke last week. Thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
On Sat, 26 Jul 2008, Tom Lane wrote: Startup scripts invariably run as root, so 'su' isn't going to ask for a password... Tom, That occurred to me after I wrote the message. Think that I'll tune the script to use a command that I know is working with 8.3.3. Many thanks, Rich -- Richard B. Shepard, Ph.D. | IntegrityCredibility Applied Ecosystem Services, Inc.|Innovation http://www.appl-ecosys.com Voice: 503-667-4517 Fax: 503-667-8863 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Wrapper to use correct version of psql?
On Sat, 26 Jul 2008, Steve Atkins wrote: The obvious thing to do is write a wrapper that will transparently run the right version of psql for the database it's connecting to. Has anyone already done that? Several times, and I never seem to have the previous rev around when writing a new one (writing useful error checks is the time consuming part). The archives to my rescue: the attached is something I just whipped together which hopefully will be the last time I do this from scratch again 'cause I can just find this post instead. This presumes you've installed all the versions into a directory tree at /opt/pgsql/version, and you have to tweak the end of the script to make it run that command instead of just printing the output. Sample session using the script: $ cat systems aaa hosta 54328.2 bbb hostb 54328.3 $ ./runpsql aaa /opt/pgsql/8.2/bin/psql -h hosta -p 5432 $ ./runpsql bbb /opt/pgsql/8.3/bin/psql -h hostb -p 5432 $ ./runpsql ccc system ccc not found in systems listing file at: systems It appends the stuff after the system name to the psql command, but you do have to worry about shell escaping with this simple implementation; example: $ ./runpsql bbb -Atc \select 1\ /opt/pgsql/8.3/bin/psql -h hostb -p 5432 -Atc select 1 -- * Greg Smith [EMAIL PROTECTED] http://www.gregsmith.com Baltimore, MD#!/bin/bash SYSTEM=$1 SYSLIST='systems' shift PARAM=$* if [ -z $SYSTEM ]; then echo Usage: $0 systemname echo Uses the system listing in the file: $SYSLIST exit 1 fi if [ ! -f $SYSLIST ]; then echo Missing systems list file $SYSLIST exit 2 fi LINE=`grep ^$SYSTEM $SYSLIST` if [ $? -ne 0 ] || [ -z $LINE ]; then echo system \$SYSTEM\ not found in systems listing file at: $SYSLIST exit 3 fi CMD=`echo $LINE | awk '{print /opt/pgsql/ $4 /bin/psql -h $2 -p $3}'` CMD=$CMD $PARAM echo $CMD #$CMD -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Problems Restarting PostgreSQL Daemon
On 27/07/2008, Rich Shepard [EMAIL PROTECTED] wrote: Well, that's the problem, Andrej. I have that script, and it worked fine with postgres-6.x through -8.1, but failed to correctly start the postmaster after the system reboot. I thought we had established that this issue was caused by the current instance pointing at the old installs data directory? I can try twiddling with the script; it calls pg_ctl, and that should work, but apparently something broke last week. That should be quite easy to tweak, really ... my current script (slightly modified from the one in contrib/startup-scripts) is attached... You may need to change the dirs in the script yet a bit. Thanks, Rich Cheers, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm rc.postgres Description: Binary data -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] PostgreSQL vs FreeBSD 7.0 as regular user
Greg Smith wrote: On Sat, 26 Jul 2008, Zoltan Boszormenyi wrote: Zoltan Boszormenyi �rta: These three settings were also set with sysctl -w ... to take effect immediately. Rebooting FreeBSD solved it. Huh? Is it really like W#@$#? Looks like the PostgreSQL documentation here ( http://www.postgresql.org/docs/current/static/kernel-resources.html ) is now outdated. From http://www.manpages.info/freebsd/sysctl.8.html : The -w option has been deprecated and is silently ignored. It's not ignored as in the whole command will have no effect. Only the switch itself is ignored. So, sysctl -w a.b=c is 100% equivalent to sysctl a.b=c Looks like the correct thing to do here now is to edit the /etc/sysctl.conf file, then issue: /etc/rc.d/sysctl reload to use those values without needing to reboot. (I don't actually have such a machine to check for sure). Yes, that will work. Sysctl.conf will not reload itself :) signature.asc Description: OpenPGP digital signature