to my last letter about embedded SQL

Started by Memphistoover 27 years ago6 messagesgeneral
Jump to latest
#1Memphisto
szoli@valerie.inf.elte.hu

Well, I investigated the problem and found out, that in fact, the table is
'created', because the file representing the table called
/usr/local/pgsql/data/base/szoli1/perftest EXISTS, but can't reach neither
via psql nor via pgaccess. But can't create a table with the same name:
szoli1=> create table perftest(number int4);
ERROR: cannot create perftest
ERROR: cannot create perftest

So there's some inconsistence in PostgreSQL.
When I found out what happened, removed the whole postgreSQL package and
reinstalled it from scratch. But when runned the program again got the
same results. However psql and pgaccess works fine when I create a table
with them and fill these tables with data.
If anyone has some idea what to do please mail me.

Thanks in advance

Sebesty���n Zolt���n

P.S.: I forgot to describe my system: It's a FreeBSD-2.2.7-RELEASE system
running on a PII-300 box

--------------------------------------------------------------------------------
Sebesty���n Zolt���n AKA Memphisto It all seems so stupid,
it makes me want to give up.
szoli@neumann.cs.elte.hu But why should I give up,
when it all seems so stupid?

MAKE INSTALL NOT WAR And please avoid Necrosoft Widows

#2Andy Lewis
alewis@mpsi.net
In reply to: Memphisto (#1)
SELECT Date

I have a table with somedate defined as date.

I want to select all rows that are from todays date back to 7 days
ago. Or in this case 10-1-1998.

data in the somedate fields appear as: 10-7-1998

Can someone help?

Thanks in advance

#3Evan Howarth
EHowarth@Intellicall.com
In reply to: Andy Lewis (#2)
Re: [GENERAL] SELECT Date

I have a table with somedate defined as date.

I want to select all rows that are from todays date back to 7 days
ago. Or in this case 10-1-1998.

Use the function age() somewhat like this:

select * from sometable
where date_part( 'epoch' , age( 'now', somedate ) ) > 604800

The 'epoch' date part is the total number of seconds between the two dates.
For other variations, see:

http://www/postgresql.org/docs/user/functions1574.htm

#4Jackson, DeJuan
djackson@cpsgroup.com
In reply to: Evan Howarth (#3)
RE: [GENERAL] SELECT Date

I have a table with somedate defined as date.

I want to select all rows that are from todays date back to 7 days
ago. Or in this case 10-1-1998.

Use the function age() somewhat like this:

select * from sometable
where date_part( 'epoch' , age( 'now', somedate ) ) > 604800

The 'epoch' date part is the total number of seconds between the two
dates.
For other variations, see:

http://www/postgresql.org/docs/user/functions1574.htm

Why don't you just use between:
select * from sometable
where somedate between now()::date and (now()::datetime - '@ 7
days'::timespan)::date;
-DEJ

#5Andy Lewis
alewis@mpsi.net
In reply to: Jackson, DeJuan (#4)
RE: [GENERAL] SELECT Date

I tried this but, got the following:

---------------------------------------
mytest=> select fagentname from feedback where ftdate between now()::date and
mytest-> (now()::datetime - '@ 7 days'::timespan)::date;
ERROR: function date(timestamp) does not exist
---------------------------------------

I have this column identified as type date and not timestamp.

Any suggestions?

On Thu, 8 Oct 1998, Jackson, DeJuan wrote:

Show quoted text

I have a table with somedate defined as date.

I want to select all rows that are from todays date back to 7 days
ago. Or in this case 10-1-1998.

Use the function age() somewhat like this:

select * from sometable
where date_part( 'epoch' , age( 'now', somedate ) ) > 604800

The 'epoch' date part is the total number of seconds between the two
dates.
For other variations, see:

http://www/postgresql.org/docs/user/functions1574.htm

Why don't you just use between:
select * from sometable
where somedate between now()::date and (now()::datetime - '@ 7
days'::timespan)::date;
-DEJ

#6Jackson, DeJuan
djackson@cpsgroup.com
In reply to: Andy Lewis (#5)
RE: [GENERAL] SELECT Date

I tried this but, got the following:

---------------------------------------
mytest=> select fagentname from feedback where ftdate between
now()::date and
mytest-> (now()::datetime - '@ 7 days'::timespan)::date;
ERROR: function date(timestamp) does not exist
---------------------------------------

I have this column identified as type date and not timestamp.

try:
SELECT fagentname
FROM feedback
WHERE '@ 7 days'::timespan >= ftdate::datetime - now()::datetime;

Show quoted text

Any suggestions?

On Thu, 8 Oct 1998, Jackson, DeJuan wrote:

I have a table with somedate defined as date.

I want to select all rows that are from todays date back to 7 days
ago. Or in this case 10-1-1998.

Use the function age() somewhat like this:

select * from sometable
where date_part( 'epoch' , age( 'now', somedate ) ) > 604800

The 'epoch' date part is the total number of seconds between the

two

dates.
For other variations, see:

http://www/postgresql.org/docs/user/functions1574.htm

Why don't you just use between:
select * from sometable
where somedate between now()::date and (now()::datetime - '@ 7
days'::timespan)::date;
-DEJ