Re: help

From: "Matt A(dot)" <survivedsushi(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: help
Date: 2005-08-25 23:10:27
Message-ID: 20050825231027.46422.qmail@web35201.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sorry to have replied directly to you. I assumed the
reply address was that of the pgsql email.A thousand
apologies.

Anyway, I am new to postgres and looking to casts. I
have wrote this question several times before and on
this version I forgot to add the exact rules of why
it's breaking and what i need it to do. I will try to
be more clear...

I use the rules to insert 0/1/null inserts into
booleans, integers, text, etc. fields.

Example: insert into table (bool_column) values
nullif('',''));
ERROR: column "bool_column" is of type boolean but
expression is of type text.

Where '' == '' should evaluate to NULL as OPAQUE
(depreciated) or similiar return instead of TEXT cast.

So if I could alter the cast from text to return
either INTEGER or TEXT, that would super! I'm not sure
if it's possible but if so I'm willing to do what it
takes to accomplish it.

I'm on a test box to see if postgresql will be
suitable for our production environment (from MSSQL).
So I can route around and tear things apart at will.

Even changing nullif() to return 1/0/null for boolean
and integer fields would be sufficient. It's hardly
used on TEXT casts.

Thanks for your time. I hope that I may have been more
helpful on this reply.

Thank you,
Matthew

--- Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:

> Please reply to the list also in the future, I'm
> going to sleep now.
> Anyway, it still works:
>
> kleptog=# create temp table x (a text);
> CREATE TABLE
> kleptog=# insert into x values (nullif('',''));
> INSERT 114760 1
> kleptog=# insert into x values (nullif('1',''));
> INSERT 114761 1
> kleptog=# select a,a is null as isnull from x;
> a | isnull
> ---+--------
> | t
> 1 | f
> (2 rows)
>
> Please show us the error you got.
>
> Have a nice day,
>
>
> On Thu, Aug 25, 2005 at 02:57:29PM -0700, Matt A.
> wrote:
> > hi. I am speaking of INSERT not SELECT
> >
> > --- Martijn van Oosterhout <kleptog(at)svana(dot)org>
> wrote:
> >
> > > Very odd, what are you trying?
> > >
> > > kleptog=# select nullif('','') is null;
> > > ?column?
> > > ----------
> > > t
> > > (1 row)
> > >
> > > kleptog=# select nullif('1','') is null;
> > > ?column?
> > > ----------
> > > f
> > > (1 row)
> > >
> > > Works for me.
> > >
> > > Have a nice day,
> > >
>
> --
> Martijn van Oosterhout <kleptog(at)svana(dot)org>
> 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.
>


__________________________________
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

In response to

  • Re: help at 2005-08-25 22:06:09 from Martijn van Oosterhout

Responses

  • Re: help at 2005-08-26 06:50:50 from Martijn van Oosterhout

Browse pgsql-general by date

  From Date Subject
Next Message Chris Travers 2005-08-25 23:15:34 Re: Postgresql replication
Previous Message Chris Travers 2005-08-25 23:00:21 Re: Postgresql replication