[SQL] Re: Wildcard in date field

2000-06-23 Thread K Parker
The suggest solution works: > SELECT * FROM my_table WHERE > date_part('month', col_name::datetime) = '06' > AND date_part('year', col_name::datetime) = > '2000'; But you can also just do a comparison: where col_name >= '2000-06-01' AND col_name <= '2000-06-30' Using the correct date f

[SQL] Re: [HACKERS] query failed , don't know why

2000-06-23 Thread Tom Lane
Jeff MacDonald <[EMAIL PROTECTED]> writes: > UPDATE members m,payments p SET m.status = 2 WHERE p.paydate > 'now'::datetime - '1 >month'::timespan and p.productid = 'xxx' and m.gid = p.gid > i'm trying to run that query and i'm getting > "parse error near m" > but it looks ok to me OK acco

[SQL] Speaking of fulltextindex...

2000-06-23 Thread Mitch Vincent
I just noticed this in some testing.. When I use my PHP application to insert text into the field that's used in the full text index it takes 9 full seconds, when investigating resource usage using 'top' I see this : Development from a completely idle start up : PID USERNAME PRI NICE SIZE

[SQL] query failed , don't know why

2000-06-23 Thread Jeff MacDonald
UPDATE members m,payments p SET m.status = 2 WHERE p.paydate > 'now'::datetime - '1 month'::timespan and p.productid = 'xxx' and m.gid = p.gid i'm trying to run that query and i'm getting "parse error near m" but it looks ok to me i'm running postgresql 7.0.2 with freebsd 4.0 stable je

Re: [SQL] Using substr with user defined types

2000-06-23 Thread D'Arcy J.M. Cain
Thus spake Tom Lane > > char * > > chkpass_rout(chkpass *password) > > That doesn't return "text", so you can't tell the system it does. > Type text is a varlena type, ie, length word followed by data. Ack! That was it. I don't understand why it didn't print my debug message at the start of th

Re: [SQL] Orderby two different columns

2000-06-23 Thread Oliver Elphick
"Mitch Vincent" wrote: >I need to order search results by the two dates. Here is the problem.. > >They want whichever date is the most recent to appear on top.. If I do >'order by resubmitted desc,created desc' I get something like this : > >Applicant Re-submitted Created >A 06/05/2

Re: [SQL] Orderby two different columns

2000-06-23 Thread Tom Lane
"Mitch Vincent" <[EMAIL PROTECTED]> writes: > Ok, see applicant J? I need him to be above C. Your example was about as transparent as mud, but maybe you are looking to sort on MAX(resubmitted, created) or something like that? Anyway I'd think that sorting on some function of the two dates is pro

Re: [SQL] Using substr with user defined types

2000-06-23 Thread Tom Lane
[EMAIL PROTECTED] (D'Arcy J.M. Cain) writes: >> Not with that much info. Sooner or later you're going to have to >> show us your C code... > char * > chkpass_rout(chkpass *password) > { > char *result; > if (password == NULL) > return (NULL); > if ((result

Re: [SQL] Merging two columns into one

2000-06-23 Thread Jeff Hoffmann
"D'Arcy J.M. Cain" wrote: > > PostgreSQL could use a > phone number type. I have been meaning to write a user defined type > for some time but never seem to get around to it. Maybe you could > give this a shot. The examples in contrib should get you started. > Once finished you can make the ph

Re: [SQL] Need to improve performance

2000-06-23 Thread Mitch Vincent
> vacuum; > vacuum analyze; > select f1.id from app_fti f1, app_fti f2 where f1.string~*'visual' and > f2.string~*'basic' and f1.id=f2.id; Use ~*'^basic' It will use the indexes I believe. Also, enable likeplanning (look in contrib/likeplanning) -- it will speed things up too.. If that doesn't h

[SQL] Need to improve performance

2000-06-23 Thread Vassili A Akimov
Hallo, My name is Vassili Akimov. I work with postgres, we maintain the main database for our sponsors on it. One of thier requirements,- perform the search through the long text field. Sometimes this field even exceeds 32k so we cut off the rest. But search trough this long field is too slow. (

[SQL] Orderby two different columns

2000-06-23 Thread Mitch Vincent
I ran into a problem today that I hope someone can help me with... I have a database (and application) that is used to track 'applicants'.. These applicants have two timestamp fields associated with their records and both have relevance as to how long the applicant has been available.. The resub

Re: [SQL] Merging two columns into one

2000-06-23 Thread D'Arcy J.M. Cain
Thus spake Oliver Elphick > SELECT col1, col2,..., areacode || phone as phone, colx, coly,... Although you may want this for easier reading. SELECT col1, col2,..., (areacode || ' ') || phone as phone, colx, coly,... Also, I would do "as fullphone" instead so that I don't get confused between

Re: [SQL] Merging two columns into one

2000-06-23 Thread D'Arcy J.M. Cain
Thus spake Gary MacMinn > I have two columns in a table (areacode and phone number) that I'd like to merge >into one (phone number) containing both sets of info. Could anyone suggest a simple >way of achieving this? Oliver showed you how to merge these together with the SQL concatenate operator

Re: [SQL] Using substr with user defined types

2000-06-23 Thread D'Arcy J.M. Cain
Thus spake Tom Lane > [EMAIL PROTECTED] (D'Arcy J.M. Cain) writes: > > Any ideas? > > Not with that much info. Sooner or later you're going to have to > show us your C code... Oh, sure. I was going to submit it to contrib when it was finished and as I said, the fprintf test I added pretty much