Re: [SQL] How to figure out when was a table created

2003-10-03 Thread achill
Well, in certain filesystems you can have the birth time (like ufs2) stored in the inode struct. So you find the file name in your $PGDATA/base directory using the oid of your table (in pg_class), and then you open that file with stat (2) or utimes (2) (or from perl) to read creation data. All

Re: [SQL] How to figure out when was a table created

2003-10-03 Thread Bruno Wolff III
On Thu, Oct 02, 2003 at 16:01:16 -0700, David B [EMAIL PROTECTED] wrote: Hi folks, I posted this question a few days ago and got no response so I guess it cannot be done (surprising!) So that leaves me with my business problem. We create a table for each days activity. After N days

Re: [SQL] Creating Index

2003-10-03 Thread Tom Lane
CN [EMAIL PROTECTED] writes: I thought I have got no more question in this thread, and I was wrong :-( Is the extra 300ms in UNION essential? Dividing, it looks like the Append node is taking about 3 microseconds per tuple, which seems kind of a lot considering it isn't really doing anything.

Re: [SQL] Data type conversion

2003-10-03 Thread Jeff Boes
Jan Pips wrote: How to convert the interval type into integer, float or any countable data type at the time of table creation using select ... into? I'm guessing you want something like this: SELECT EXTRACT('EPOCH' FROM INTERVAL '1 days 4 hours 15 minutes 23 seconds'); -- Jeff Boes

[SQL] help with rule and notification

2003-10-03 Thread Theodore Petrosky
I don't know if this is the correct forum for this question but I will start here... I have a job tracking system that I am developing with postgresql and mac os x. I have all the pieces in place (mostly) but i am having a problem with notify.. I am trying to set up things so that two (or more)

Re: [SQL] Result set granularity..

2003-10-03 Thread Rasmus Aveskogh
Well, there is a rowid and a rownum in Oracle. I don't remember which, but one of them is significant to the current recieved result set only. Hence; you can use it to manipulate and restrict the result set rather than the data you're recieving from the tables. I.e. rownum 1 will always be the

[SQL] Data type conversion

2003-10-03 Thread Jan Pips
How to convert the interval type into integer, float or any countable data type at the time of table creation using select ... into? Pips ---(end of broadcast)--- TIP 8: explain analyze is your friend

[SQL] Regarding decode function

2003-10-03 Thread Buchi_Babu
Hi All, Rightnow I have a query which uses decode functionto get data in Oracle database, I want know is there any alternative function to decodewhich can do thedecode functionality in Postgresql. Thanks in advance for your great help. Thanks Babu Mannem

Re: [SQL] How to figure out when was a table created

2003-10-03 Thread btober
Can you add two columns to the table creation definition, one with a default current timestamp, the second to be updated with current time in an on update trigger. Then perhaps you could do something like SELECT min(new_insert_timestamp_column), max(new_update_timestamp_column) FROM

[SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread John B. Scalia
All, Im not certain if what Im trying to do is legal, but if I execute a statement like: UPDATE my_table SET field1=new_value AND SET field2=different_value WHERE my_table_id = key; in psql, it reports that it has successfully updated one record. However, the record does not

Re: [SQL] Data type conversion

2003-10-03 Thread Bruno Wolff III
On Fri, Oct 03, 2003 at 09:23:46 +0200, Jan Pips [EMAIL PROTECTED] wrote: How to convert the interval type into integer, float or any countable data type at the time of table creation using select ... into? You can use extract to do that. See the date/time function documentation. Note that

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Bruno Wolff III
On Fri, Oct 03, 2003 at 09:18:44 -0400, John B. Scalia [EMAIL PROTECTED] wrote: All, I'm not certain if what I'm trying to do is legal, but if I execute a statement like: UPDATE my_table SET field1='new_value' AND SET field2='different_value' WHERE my_table_id = 'key'; It

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Wei Weng
Shouldn't that be UPDATE my_table SET field1 = 'new_value', field2 = 'different_value' WHERE my_table_id = 'key';? Wei On Fri, 3 Oct 2003, John B. Scalia wrote: All, I'm not certain if what I'm trying to do is legal, but if I execute a statement like: UPDATE my_table SET

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Josh Berkus
John, UPDATE my_table SET field1='new_value' AND SET field2='different_value' WHERE my_table_id = 'key'; Well, your SQL is bad: UPDATE my_table SET field1='new_value, field2='different_value' WHERE my_table_id = 'key'; in psql, it reports that it has successfully updated one record.

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Josh Berkus
John, Yeah, I figured out my SQL was bad and had switched to the comma separated version, instead. In my mind, the first form should have caused an error. I've attached a cut-and-pasted session from psql where I used this syntax on a test table. While edited for brevity and to obscure

Re: [SQL] Bug in psql - Postgresql 7.3.1?

2003-10-03 Thread Tom Lane
John B. Scalia [EMAIL PROTECTED] writes: UPDATE my_table SET field1='new_value' AND SET field2='different_value' WHERE my_table_id = 'key'; The other responses have focused on your obvious syntax error, but I'm assuming you didn't actually cut-and-paste that from your psql session. in psql,

[SQL] HeapTuple-t_tableOid==0 after SPI_exec

2003-10-03 Thread achill
Hi, i notice that when HeapTuple data are populated by a trigger then the table oid can be retrieved from HeapTuple-t_tableOid. When HeapTuple is populated by SPI_exec(select * from foobar when id=667); tuple = SPI_tuptable-tvals[0] (id is PK and row with 667 exists) then tuple-t_tableOid is

Re: [SQL] HeapTuple-t_tableOid==0 after SPI_exec

2003-10-03 Thread Tom Lane
[EMAIL PROTECTED] writes: When HeapTuple is populated by SPI_exec(select * from foobar when id=667); tuple = SPI_tuptable-tvals[0] (id is PK and row with 667 exists) then tuple-t_tableOid is always 0. The result of a SELECT is never a raw table tuple, not even when it's a straight select *

Re: [SQL] HeapTuple-t_tableOid==0 after SPI_exec

2003-10-03 Thread Tom Lane
[EMAIL PROTECTED] writes: are there gonna be changes in SPI or internal structs in 7.4? No more than usual ;-). You will need to recompile shared libraries, but (in theory) source code changes shouldn't be needed. You might want to think about upgrading elog() calls to ereport() though.