[GENERAL] How to delete all operators

2006-03-31 Thread Martin Pohl

Hi,

I have a database with operators and functions in plpgsql.
To update the data to the latest version I would like to drop all operators.
There might be some, that I don't know. I don't have access to the database,
but have to write a script, that will update the data.

Is there any way to drop all operators (given they are all in the schema
"public) in a script?

Something like (pseudocode):
Drop all operators in schema "public"

Thanks in advance for answers

-- 
E-Mails und Internet immer und überall!
1&1 PocketWeb, perfekt mit GMX: http://www.gmx.net/de/go/pocketweb

---(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] Insert a default timestamp when nothing given

2006-01-19 Thread Martin Pohl
Hi,

> > Not directly. I suppose you could create a view that converted the
> > value to the right date on insert.
> I think a trigger might make more sense.

That was a very good idea! I tought it would solve my problem. Unfortunately
it didn't: I still get the "invalid syntax" error (I ensured that the
trigger worked by using other values). Apparently the syntax check is done,
before the trigger is called:

create or replace function test() returns trigger as '
begin

if NEW.datum =  THEN
NEW.datum := ''01.01.1900'';
end if;
return NEW;
end;
' language plpgsql;

create trigger test before insert or update on foo
for each row execute procedure test();


Adding a default value will also not work, since the given date is not a
correct timestampz when inserting. So the default value doesn't help.


I know that inserting '' is wrong in the first place, and that Postgre works
correctly at this point. But I can't help it - the application I have to
port does it and I can't change it. Therefore I need a smart workaround for
a sloppy programming in the application and a sloppy MS SQL.
(This is not meant rude in any way, it's just the situation I was given in a
task)

Does anyone have any other suggestions or ideas? 

-- 
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] Insert a default timestamp when nothing given

2006-01-19 Thread Martin Pohl

Hi,

I have to port an application from MS SQL7 to Postgresql (7.4).

When I have a column with a datetime on MS SQL7 the following is possible:
INSERT INTO mytable (mydate) values ('');

In this case MSSQL will insert '01.01.1900' as the date.

When I do the same on Postgresql it says:
"invalid input syntax for type timestamp with time zone: ''".

Unfortunately the application I have to port often uses '' as a date.

My question:
Is there any way to have MSSQLs behavior in PostgreSQL?

Thanks for answers

-- 
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

---(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