pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Regarding boolean datatype
3+ messages / 2 participants
[nested] [flat]

* Regarding boolean datatype
@ 2002-12-05 09:11  kanika singh <kanikasingh20@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: kanika singh @ 2002-12-05 09:11 UTC (permalink / raw)
  To: pgsql-sql

Hello all,

this is my first interaction with this list. I have a
problem. I was using MSSQL Server as db, now i m
changing to Postgres. I know that the bit type in
MSSQLserver is boolean in Postgres. 

So, i have the following query and getting the
following error:Why???

strSql	= " Update parts Set name = ? , description = ?
world_market = ?, part = ? , unit_of_measure = ? 
Where depot= ?;

prepStmt = conn.prepareStatement(strSql);
prepStmt.setString( 1, Pname) ;
prepStmt.setString( 2, Pdesc) ;
prepStmt.setBoolean(3, BoolWM) ;
prepStmt.setString( 4, strPart);
prepStmt.setString( 5, strUoM);
prepStmt.setString( 6, strDepot);

This is how i m assigning value to BoolWM,

boolean BoolWM ;
 if ( WM.equals("False")) { 
    BoolWM = false ;
  } else {
     BoolWM = true;
  }

Error is:::

SQLError ERROR:  Unable to identify an operator '~~'
for types 'boolean' and 'unknown'
You will have to retype this query using an explicit
cast						

I know, somewhere i m making mistake, but where??
Moreover, if i m updating the database with the above
query, the db is giving the error and deleting the
data from the db. As per my understanding it should
automatically rollback. What is the problem???

What are the other coding rules for Postgres??

Please guide.
Thanks and regards

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Regarding boolean datatype
@ 2002-12-05 10:29  Richard Huxton <dev@archonet.com>
  parent: kanika singh <kanikasingh20@yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Richard Huxton @ 2002-12-05 10:29 UTC (permalink / raw)
  To: kanika singh <kanikasingh20@yahoo.com>; pgsql-sql

On Thursday 05 Dec 2002 9:11 am, kanika singh wrote:
> Hello all,
>
> this is my first interaction with this list. I have a
> problem. I was using MSSQL Server as db, now i m
> changing to Postgres. I know that the bit type in
> MSSQLserver is boolean in Postgres.

There's also a bit type if that's really what you want, but in this case I 
think boolean is right.
PS - if you get error messages again, please let us know what version and 
client you are using (e.g. PostgreSQL v7.2.1 from jdbc)

> strSql	= " Update parts Set name = ? , description = ?
> world_market = ?, part = ? , unit_of_measure = ?
> Where depot= ?;
>
> prepStmt = conn.prepareStatement(strSql);
> prepStmt.setString( 1, Pname) ;
> prepStmt.setString( 2, Pdesc) ;
> prepStmt.setBoolean(3, BoolWM) ;
[snip]
> SQLError ERROR:  Unable to identify an operator '~~'
> for types 'boolean' and 'unknown'
> You will have to retype this query using an explicit
> cast

Are you sure this error goes with this query? I don't see any use of LIKE here 
(which is what ~~ does for you).

> I know, somewhere i m making mistake, but where??
> Moreover, if i m updating the database with the above
> query, the db is giving the error and deleting the
> data from the db. As per my understanding it should
> automatically rollback. What is the problem???

I find this unlikely. If Postgresql was in the habit of deleting data without 
being asked to there'd be mention of it. I suggest you turn query logging on 
(in your postgresql.conf file) while you try to reproduce this. That will 
show you what is really happening.

> What are the other coding rules for Postgres??

Manuals are at http://www.postgresql.org/
Extra info at http://techdocs.postgresql.org/ (including some online books)
Mailing lists you know about.

-- 
  Richard Huxton



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Regarding boolean datatype
@ 2002-12-05 11:04  kanika singh <kanikasingh20@yahoo.com>
  parent: Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 3+ messages in thread

From: kanika singh @ 2002-12-05 11:04 UTC (permalink / raw)
  To: Richard Huxton <dev@archonet.com>; pgsql-sql

Thanks for the reply.
I will definitely look into it. and will come back to
you.

thanks and regards,
Kanika
--- Richard Huxton <dev@archonet.com> wrote:
> On Thursday 05 Dec 2002 9:11 am, kanika singh wrote:
> > Hello all,
> >
> > this is my first interaction with this list. I
> have a
> > problem. I was using MSSQL Server as db, now i m
> > changing to Postgres. I know that the bit type in
> > MSSQLserver is boolean in Postgres.
> 
> There's also a bit type if that's really what you
> want, but in this case I 
> think boolean is right.
> PS - if you get error messages again, please let us
> know what version and 
> client you are using (e.g. PostgreSQL v7.2.1 from
> jdbc)
> 
> > strSql	= " Update parts Set name = ? , description
> = ?
> > world_market = ?, part = ? , unit_of_measure = ?
> > Where depot= ?;
> >
> > prepStmt = conn.prepareStatement(strSql);
> > prepStmt.setString( 1, Pname) ;
> > prepStmt.setString( 2, Pdesc) ;
> > prepStmt.setBoolean(3, BoolWM) ;
> [snip]
> > SQLError ERROR:  Unable to identify an operator
> '~~'
> > for types 'boolean' and 'unknown'
> > You will have to retype this query using an
> explicit
> > cast
> 
> Are you sure this error goes with this query? I
> don't see any use of LIKE here 
> (which is what ~~ does for you).
> 
> > I know, somewhere i m making mistake, but where??
> > Moreover, if i m updating the database with the
> above
> > query, the db is giving the error and deleting the
> > data from the db. As per my understanding it
> should
> > automatically rollback. What is the problem???
> 
> I find this unlikely. If Postgresql was in the habit
> of deleting data without 
> being asked to there'd be mention of it. I suggest
> you turn query logging on 
> (in your postgresql.conf file) while you try to
> reproduce this. That will 
> show you what is really happening.
> 
> > What are the other coding rules for Postgres??
> 
> Manuals are at http://www.postgresql.org/
> Extra info at http://techdocs.postgresql.org/
> (including some online books)
> Mailing lists you know about.
> 
> -- 
>   Richard Huxton
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2002-12-05 11:04 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-05 09:11 Regarding boolean datatype kanika singh <kanikasingh20@yahoo.com>
2002-12-05 10:29 ` Richard Huxton <dev@archonet.com>
2002-12-05 11:04   ` kanika singh <kanikasingh20@yahoo.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox