Re: [SQL] List table with same column name

2003-10-23 Thread achill
On Thu, 23 Oct 2003, Peter Childs wrote: > > > On Thu, 23 Oct 2003 [EMAIL PROTECTED] wrote: > > > On Thu, 23 Oct 2003, Abdul Wahab Dahalan wrote: > > > > > Hi! > > > How do I list all the tables in the database which has a same column name?. > > > > SELECT t1.relname,a1.attname,t2.relname from

Re: [SQL] List table with same column name

2003-10-23 Thread achill
On Thu, 23 Oct 2003, Abdul Wahab Dahalan wrote: > Hi! > How do I list all the tables in the database which has a same column name?. SELECT t1.relname,a1.attname,t2.relname from pg_class t1,pg_attribute a1,pg_class t2,pg_attribute a2 where a1.attrelid=t1.oid and t1.relkind='r' and a1.attnum>0 an

Re: [SQL] Timestamp

2003-10-22 Thread achill
On Wed, 22 Oct 2003, Abdul Wahab Dahalan wrote: > Hi ! > In my database I've a field "departure" with timestamp without time zone > data type. > eg : > departure > 2003-11-01 14:29:46 Maybe SET DateStyle TO 'German' ; SELECT replace(departure,'.','-') from ; is close to what you want, but be

Re: [SQL] Question regarding triggers

2003-10-20 Thread achill
On Mon, 20 Oct 2003, A.Bhuvaneswaran wrote: > > Why dont you try to write your trigger in C? > > Hi, one cannot write triggered procedures in C. Currently, it can only be > written in plpsgql. Where did you get that impression from? Do an SELECT tgrelid,tgfoid,proname from pg_trigger,pg_proc wh

Re: [SQL] Question regarding triggers

2003-10-20 Thread achill
Why dont you try to write your trigger in C? On Mon, 20 Oct 2003, Dmitri Fuerle wrote: > >I'm writing a trigger but running into problems. My problem is that I can not > determine anyway to tell what fields are in the *new* record. Without knowing what > fields are there I get runtime e

Re: [SQL] Object description at Client Window

2003-10-17 Thread achill
On Fri, 17 Oct 2003, Kumar wrote: > But I have get into another problem. While I execute the following command I > could get the result as U can see below > > etgsuite=# SELECT a.attname,format_type(a.atttypid, a.atttypmod), > a.attnotnull, a.atthasd > ef, a.attnum > FROM pg_class c, pg_attribute

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

2003-10-03 Thread achill
On Fri, 3 Oct 2003, Tom Lane wrote: > > I think in 7.4 there may be an optimization that skips the tuple > projection step in this particular case, but if you can in fact see > t_tableOid in 7.4, it'd be an implementation artifact rather than > something we will promise to support in future. The

[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

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

2003-10-02 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 t