• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: postgresql and 'text' prototype
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: postgresql and 'text' prototype


  • Subject: Re: postgresql and 'text' prototype
  • From: email@hidden
  • Date: Tue, 1 Jul 2008 12:29:27 -0700 (PDT)

I am just learning migrations and this was a test case. Although I read that PG documentation that suggests that there is no difference between a varchar(n) and text type.

How can I use table.newColumn for a boolean type column? if I use newBooleanColumn, it is creating an int type column. PG creates a boolean that return t or f.


create table testtbl (id int, mybool boolean);

insert into testtbl (id, mybool) values (1, 'YES');

psql testtbl

mytest=# \d testtbl

Table "public.testtbl"

 Column |  Type   | Modifiers
--------+---------+-----------
 id     | integer |
 mybool | boolean |

mytest=# select * from testtbl;                                                                                                                                       id | mybool
----+--------
  1 | t
(1 row)


I guess I could just use the varchar(5) column and use the kludge for inserting true and false.


Ted



> Message: 10
> Date: Tue, 1 Jul 2008 12:28:48 -0400
> From: Mike Schrag <email@hidden>
> Subject: Re: postgresql and 'text' prototype
> To: webobjects-dev Apple <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="us-ascii"
>
> > Using a StringColumn is not working.
> >
> > You should use table.newColumn("c_firstname",
> > java.sql.Types.LONGVARCHAR, 0, 0, 0, false, "");
> Yeah, the newStringColumn will not work for this ... Basically it
> tries to guess which migration method it should use, and currently
> it's not able to guess this type.  You can also try newClobColumn and
> see if that uses "text" -- not sure if there is a clob in pg, so it
> might default to that.

> > But why are you using TEXT types for small text fields like
> > firstname. Correct me if I'm wrong but I assume that you have much
> > more performance and indexing power if you use varchar instead.
> from pg manual: "Tip: There are no performance differences between
> these three types, apart from the increased storage size when using
> the blank-padded type. While character(n) has performance advantages
> in some other database systems, it has
> no such advantages in PostgreSQL. In most situations text or character
> varying should be used instead."

> ms



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: WO 5.4.2 is out
  • Next by Date: Re: WO 5.4.2 is out
  • Previous by thread: Re: postgresql and 'text' prototype
  • Next by thread: Change to HTTP instead of HTTPS for WebServerResources
  • Index(es):
    • Date
    • Thread