"Leandro Pinto Fava" <leandro@unisc.br> wrote...
>Could I use a rule to force the case to lower for some text fields? The
>way I read the SQL RefGuide, the rule (and thus the stored procedure)
>fire after the change has already taken place. Or should I just do
> UPDATE objects SET name=lowercase(name)
>in the stored procedure?
Sure, you can use a rule and DB procedure to lowercase specific
text fields. If those fields happen to be structure or index keys,
you'll cause some row moving-around, but it will work. Or you
can arrange for the application to insert both an exact-case version
and a lowercase version. Or just a lowercase version.
I wouldn't do a mass update (without a where clause) unless you really
want to update all rows in the table indiscriminately.
At 1:10 AM -0700 9/20/2004, Spartacus wrote:
>"Leandro Pinto Fava" <leandro@unisc.br> wrote in message news:<mailman.4.1094754827.655.info-ingres@ams.org>...
>
[quoted text clipped - 7 lines]
>
>How would I compile this file?
aducompile. Read all about it in the commands reference. There
might be some info on collation sequences elsewhere too, I'm guessing
in the DBA manual.
Karl
Emiliano - 20 Sep 2004 18:16 GMT
> Sure, you can use a rule and DB procedure to lowercase specific
> text fields. If those fields happen to be structure or index keys,
> you'll cause some row moving-around, but it will work.
I don't expect many updates to these fields. Lowercasing them would
simply mean I could use a simple unique constraint. So I guess that I
could just do (where 'username' would be the PK field)
UPDATE users SET username = lowercase(username) where username = new.username
in the SP triggered by the rule?
> Or you
> can arrange for the application to insert both an exact-case version
> and a lowercase version. Or just a lowercase version.
all-lowercase would do, but there'll be multiple apps talking to this
database. I'd rather see the database enforce the validity of the field.
> I wouldn't do a mass update (without a where clause) unless you really
> want to update all rows in the table indiscriminately.
Nope, I don't, I just wasn't really sure how I'd pick out the field that
was changed or added (I hope the above is correct). I was used to pre-
and post triggers, so I could just change values right before the actual
update/insert was even performed.

Signature
Emiliano