[SQL] Unresolved external: tgetent

2004-12-10 Thread Christoph Haller
I doubt this is the right list, but it's the only one I'm subscribed to,

so please, if one of the core members is reading this, forward it to the
right one.

I have successfully compiled and installed 7.4.5 yesterday.
After doing 'make' I saw the line "Ready to install".
template1=# select version();
  version

 PostgreSQL 7.4.5 on hppa2.0w-hp-hpux11.00, compiled by GCC gcc (GCC)
3.3.1
(1 row)

But when I started psql it immediately core dumped with
libreadline.sl.5 Unresolved external: tgetent

I did a search on the mailing list archives and got 63 hits on
'tgetent',
dating from 1997 to 2004, all having the same problem,
the missing '-ltermcap' in LIBS in src/Makefile.global.

After distclean and doing configure LIBS="-ltermcap" ...
and make again it finally worked.

In http://archives.postgresql.org/pgsql-bugs/2001-09/msg00023.php
Peter Eisentraut writes
> LIBS = -lz -lresolv -lcompat -lm -lutil -ltermcap -lreadline

That's a good fix.

The current CVS tip also works around this problem.

But the 7.4.5 src/Makefile.global still has this:
LIBS = -lz -lreadline -lPW -lgen -lBSD -ldld -lnsl -lm

So it appears this fix must have been lost anywhere.

Regards, Christoph




---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


[SQL] Cast NULL into Timestamp?

2004-12-10 Thread Wei Weng
I have a table
create table temp
(
tempdatetimestamp,
tempnamevarchar(10)
);
And I tried to insert the following:
insert into table temp (tempname, tempdate)
select distinct 'tempname', null from some_other_relevant_table;
And I got an error that says "column "tempdate" is of type timestamp ... but 
expression is of type text... will need to rewrite or cast the expression".

I really need the distinct. Is there anyway to cast this NULL into a 
timestamp or any other workarounds?

Thanks
Wei
---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?
  http://www.postgresql.org/docs/faqs/FAQ.html


[SQL] Create Calendar

2004-12-10 Thread Muhyiddin A.M Hayat



Dear All,
 
How to create Calendar using Function/View. 

For example i would like to display date 2004-12-01 
to 2004-12-20. 
 
date
--
2004-12-01 
2004-12-02 
2004-12-03 
2004-12-04 
2004-12-05
..
.. 
2004-12-20 


[SQL] filtering

2004-12-10 Thread Kevin B.
Hi,

I have a 14 million row table with one index on two fields one is a varchar
the other is a date.  The combination of the two makes the row unique.

Data
-
name  date... other fields
a 1/1/01
a 1/2/01
a 1/3/01
b 1/1/01
b 1/2/01
d 1/1/01
d 1/2/01

I have a table with just the names.  each name occurs once.
UName
-
name
a
b
c
d

I've tried a number of queries to find which name is in UName but not in
Data.   However, they are all taking too long (more than 30 minutes - but
the hard drive is a slow 4200rpm IDE).

What is the quickest query to get the result that I want?  Also, should I
put another index on the Data table for "name" only?

Thanks









---(end of broadcast)---
TIP 8: explain analyze is your friend


[SQL] replacing mysql enum

2004-12-10 Thread Kenneth Gonsalves
hi,

from mysql:

field enum('a','b','c') default null,

i translated this as:

field varchar(2) check (field in (null,'a','b','c')),

is it necessary to put the 'null' in the check condition? if not will pg 
permit you to enter a null value in the field?

regards
kg

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] Cast NULL into Timestamp?

2004-12-10 Thread Josh Berkus
Wei,

> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null from some_other_relevant_table;

I don't think you're reporting the error exactly as it happened.  Try cutting 
and pasting your actual PSQL session into your e-mail.

Perhaps you are mixing up the column order?

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster


Re: [SQL] Create Calendar

2004-12-10 Thread Michael Fuhr
On Sat, Dec 11, 2004 at 03:26:33AM +0800, Muhyiddin A.M Hayat wrote:

> How to create Calendar using Function/View. 
> For example i would like to display date 2004-12-01 to 2004-12-20. 

You could write a function that returns SETOF DATE.  Some sections
of the documentation you'll want to study are:

"Data Types" chapter, "Date/Time Types" section

"Functions and Operators" chapter, "Date/Time Functions and
Operators" section

"PL/pgSQL - SQL Procedural Language" chapter, especially the
"Control Structures" section

If you have trouble then please post what you've tried with an
explanation of how you'd like it to work and a description of
what actually happens.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---(end of broadcast)---
TIP 9: the planner will ignore your desire to choose an index scan if your
  joining column's datatypes do not match


Re: [SQL] Cast NULL into Timestamp?

2004-12-10 Thread Stephan Szabo
On Fri, 10 Dec 2004, Wei Weng wrote:

> I have a table
>
> create table temp
> (
>   tempdatetimestamp,
>   tempnamevarchar(10)
> );
>
> And I tried to insert the following:
>
> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null from some_other_relevant_table;
>
> And I got an error that says "column "tempdate" is of type timestamp ... but
> expression is of type text... will need to rewrite or cast the expression".
>
> I really need the distinct. Is there anyway to cast this NULL into a
> timestamp or any other workarounds?

CAST(NULL as timestamp) should work.

---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])


Re: [SQL] Cast NULL into Timestamp?

2004-12-10 Thread Steve Crawford
On Friday 10 December 2004 11:24 am, Wei Weng wrote:
> I have a table
>
> create table temp
> (
>   tempdatetimestamp,
>   tempnamevarchar(10)
> );
>
> And I tried to insert the following:
>
> insert into table temp (tempname, tempdate)
> select distinct 'tempname', null from some_other_relevant_table;
>
> And I got an error that says "column "tempdate" is of type
> timestamp ... but expression is of type text... will need to
> rewrite or cast the expression".
>
> I really need the distinct. Is there anyway to cast this NULL into
> a timestamp or any other workarounds?

How about:
insert into table temp (tempname)
select distinct 'tempname' from some_other_relevant_table;

Unless there's something you have left out in describing your setup 
this will leave the tempdate column null.

Cheers,
Steve


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html