[GENERAL] IF EXISTS

2005-11-14 Thread P.M
Hi,

I would like to know if "IF EXISTS" exists under
postgresql ?
because i did not find it.

before to create users or database, i would like to be
sure that they do not exist already.

so how can i test it and do something like :

IF EXISTS database "test" DROP database "test";

thanks a lot,
Maileen



__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


[GENERAL] to create a database...

2005-11-20 Thread P.M
Hi,I'm creating a Visual Basic.net application and i would like to make my application versatile.For that, it should be able to create the same DB on different RDBMS like PostGreSQL, MySQL or MSSQL.I would like to know what is the best way to create a DB from scratch... (DB, table, users, functions,...)- to use a SQL text file- to create a new function inside template1 db, and to execute it after,- ...please, help me.thanks a lot,Maileen
		 Yahoo! FareChase - Search multiple travel sites in one click.

 

 

[GENERAL] drop user / role if exists

2006-05-21 Thread P.M
Hi,How under postgreSQL 7 do the equivalent as DROP USER / ROLE  IF EXISTS ?my web provider only support postgreSQL 7 :-(thanks a lot,Maileen
		Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

Re: [GENERAL] drop user / role if exists

2006-05-21 Thread P.M
Thanks Martijn, but i'm currently working on the SQL script to create the full database. Not on some stored procedure.And when i run the SQL script, PostgreSQL stops just on first errorso if user does not exist, my script is not any longer run :-(do you have any idea how to pass over this issue ?thanks a lot,MaileenMartijn van Oosterhout  wrote: On Sun, May 21, 2006 at 02:08:38AM -0700, P.M wrote:> Hi,> > How under postgreSQL 7 do the equivalent as DROP USER / ROLE  IF EXISTS ?> my web provider only support postgreSQL 7 :-(Do the DROP USER and ignore the error if it doesn't exist.-- Martijn van Oosterhout  http://svana.org/kleptog/> From each according to his ability. To each according to his ability to
 litigate.
		Be a chatter box. Enjoy free PC-to-PC calls  with Yahoo! Messenger with Voice.

Re: [GENERAL] drop user / role if exists

2006-05-21 Thread P.M
To run the script i use :under psql command line, i load my SQL script file via :psql -i myfile;Martijn van Oosterhout  wrote: On Sun, May 21, 2006 at 02:25:44AM -0700, P.M wrote:> Thanks Martijn, but i'm currently working on the SQL script to create the full database. Not on some stored procedure.> > And when i run the SQL script, PostgreSQL stops just on first> errorso if user does not exist, my script is not any longer run> :-(> > do you have any idea how to pass over this issue ?That's odd. psql doesn't stop on errors unless you enableON_ERROR_STOP, which is not the default. What are you using to run thescript?Have a nice day,-- Martijn van Oosterhout  http://svana.org/kleptog/>
 From each according to his ability. To each according to his ability to litigate.
		Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

Re: [GENERAL] drop user / role if exists

2006-05-21 Thread P.M
first of all, it's not -i as i wrote but \ii work under windows OS.and my script is working now.thanks for your helpMartijn van Oosterhout  wrote: On Sun, May 21, 2006 at 02:59:25AM -0700, P.M wrote:> To run the script i use :> > under psql command line, i load my SQL script file via :> > psql -i myfile;Don't know what -i does, it's not a supported option, perhaps you mean-f?In any case, my version of postgres 7.4.7 works fine:$ cat /tmp/fdrop user idontexist;drop user indontexisteither;drop user foo;$ psql -f /tmp/f kleptogpsql:/tmp/f:1: ERROR:  user "idontexist" does not existpsql:/tmp/f:2: ERROR:  user "indontexisteither" does not existpsql:/tmp/f:3: ERROR:  user "foo" does not exist$So I think
 you need to post the actual error before we can help youfurther.Have a nice day,-- Martijn van Oosterhout  http://svana.org/kleptog/> From each according to his ability. To each according to his ability to litigate.
		How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

[GENERAL] move from 1 database to another

2006-05-25 Thread P.M
Hi,I would like to know how can i move from 1 database to another one ?basically i want to run a *.sql script in which i connect under a particular database (for example : template1 or postgres) and my *.sql script should create a new database (for example : test) and after execute several SQL command under test database.thanks a lot,Maileen
		Blab-away for as little as 1¢/min. Make  PC-to-Phone Calls using Yahoo! Messenger with Voice.

Re: [GENERAL] move from 1 database to another

2006-05-26 Thread P.M
Thanks.it works well.Ragnar <[EMAIL PROTECTED]> wrote: On fim, 2006-05-25 at 11:52 -0700, P.M wrote:> I would like to know how can i move from 1 database to another one ?> > basically i want to run a *.sql script in which i connect under a> particular database (for example : template1 or postgres) and my *.sql> script should create a new database (for example : test) and after> execute several SQL command under test database.I guess you are asking how to connect to a new databasein the middleof a sql scriptAssuming the script will be run by psql, you can use\connect testgnari---(end of broadcast)---TIP 4: Have you searched our list archives?  
 http://archives.postgresql.org
		Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

[GENERAL] error in SELECT

2006-05-27 Thread P.M
Hi,i've just migrated a stored procedure from MySQl to PostgreSQL and i have the following error :ERROR:  syntax error at or near "SELECT" at character 371here is my function in PostgreSQL :CREATE OR REPLACE FUNCTION immense_sp001(VARCHAR,VARCHAR, service_nom VARCHAR, OUT result BOOLEAN, OUT error_message VARCHAR)RETURNS record LANGUAGE plpgsqlAS 'BEGIN  DECLARE    username varchar :=$1;    strhash varchar :=$2;    Profile_Detected INTEGER;    Service_Already_Exist INTEGER;    /* detect if the user logged in exists in database */    SELECT count(*) INTO Profile_Detected FROM profiles WHERE login=username AND pwd=strhash;    if (Profile_Detected = 1) then  /* detect if service already exists in database */  SELECT
 count(*)  INTO Service_Already_Exist  FROM immense.services  WHERE service_nom = service_name;  if (Service_Already_Exist = 0) then /* to reset AUTO_INCREMENT field : service_id */ alter table services auto_increment=1;    /* service does not exist, so we can add it */    insert into immense.services  set service_name = service_nom;    set result = false;    set error_message="new service created";  else    /* service already exists in
 database and can not be created */    set result = true;    set error_message = "service already exists";  end if;    else  set result=true;  set error_message = "user does not exist";    end if;END;'-What could it be ? I'm lost :-(thanks for help.Maileen
		New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.

Re: [GENERAL] error in SELECT

2006-05-27 Thread P.M
Hi Tom,in fact,i needed to move the DECLARE before begin and to adjust some autoincrement...and the problem is solved ;-)thx,MaileenTom Lane <[EMAIL PROTECTED]> wrote: "P.M" <[EMAIL PROTECTED]> writes:> here is my function in PostgreSQL :> CREATE OR REPLACE FUNCTION immense_sp001(VARCHAR,VARCHAR, service_nom VARCHAR, OUT result BOOLEAN, OUT error_message VARCHAR)> RETURNS record LANGUAGE plpgsql> AS '> BEGIN>   DECLARE> username varchar :=$1;> strhash varchar :=$2;> Profile_Detected INTEGER;> Service_Already_Exist INTEGER;> /* detect if the user logged in exists in database */> SELECT count(*) INTO Profile_Detected FROM profiles WHERE login=username AND pwd=strhash;The BEGIN goes after the
 variable declarations, not before them.You're going to have some problems with those double-quoted stringliterals too; that's not the correct syntax for string literals.And you don't use "set" when assigning to a plpgsql variable.Might be a good idea to practice on some toy functions until you've gotsome familiarity with plpgsql syntax, rather than diving in with portingmany-line functions.  A big function is too hard when you're trying tofix many misconceptions at once.   regards, tom lane
		Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

[GENERAL] stored function and grant execute

2006-05-28 Thread P.M
Hi,I'm developping a web application which use PostgreSQL as database.I'm quite surprise to see that grant execute does not exist for PostgreSQL v7.x, but only in v8.xSo how can i grant such right (execute) to my user in v7.x ? because function were already existing in v7.xthanks a lot,Maileen
		Ring'em or ping'em. Make  PC-to-phone calls as low as 1¢/min with Yahoo! Messenger with Voice.

[GENERAL] postgres 7 and eastern language

2006-05-28 Thread P.M
Hi,i would like to know what i have to do to make postgres 7 store some eastern languages with their particular letters. like czech, slovak, and so oni'm sure that some unicode possibilities exist but which ones ?basically, end user will type some text including these special characters and i would like to be sure to store them in postgres DB perfectly.thanks a lot,Maileen
		Love cheap thrills? Enjoy PC-to-Phone  calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice.

[GENERAL] Case for postgreSQL

2006-06-04 Thread P.M
Hi,I would like to know if it exists a good case tool for creating DB into PostgreSQL ?thanks a lot,Maileen __Do You Yahoo!?Tired of spam?  Yahoo! Mail has the best spam protection around http://mail.yahoo.com 

[GENERAL] phppgadmin 4.0.1

2006-06-17 Thread P.M
Hi,i run on Windows XP + apache + php + postgresql 8.1.When i try to log-in with phppgadmin, i have the following error message :"Login disallowed for security reasons."based on some info from internet, i've setup the following value : true to $conf['owned_only'] = true;but nothing changed.my login has a non blank password and therefore, i do not understand what could be the problem.thanks a lot,Maileen 
		Do you Yahoo!? Everyone is raving about the  all-new Yahoo! Mail Beta.