Thread: Make TIMESTAMP + TIME in the source code
Hello, I'm writinng again because I need to make some validation for<br />the incoming data (VALUES... on the INSERT-Stmt).This validation<br />is based on adding a TIMESTAMP and a TIME kind of data.<br /><br />From the Shell I canmake: <br /><br /><span style="font-weight: bold;">template1=#</span> select timestamp '02/03/85 7:00pm'+'00:00:02.3450'as "TIMESTAMP+TIME";<br /><br />And that would give me the next result:<br /><span style="font-weight:bold;"> <br /> TIMESTAMP+TIME</span><br /> -------------------------<br /> 1985-02-03 19:00:02.345<br/><br />That's exactly wath I need to do, obtain the result from adding a TIMESTAMP<br />and a TIME, but Imust do it from the Postgre's source code, since I'm working <br />on modifying Postgres for a University Project (herein Venezuela we call it<br />"Tesis" or "Graduation Special Work".<br /><br />Due to this, I need to know if there'sa special function on Postgre's backend <br />code that can do this.<br /><br />Greetings, I hope you could help meon this.<br /><br />PD: in adition, both data (TIMESTAMP and TIME) are stored in strings (char *).<br />The TIME is storedon the <span style="font-weight: bold;"> <span style="font-style: italic;">pg_class</span></span> structure (thanksto a modification I made),<br />and the TIMESTAMP is given on the INSERT values.<br />-- <br />Luis D. García M.<br/><br />Telf: (+58) 2418662663 <br />Cel.: (+58) 4143482018 <br /><br />- FACYT - UC -<br />- Computación -
On Mon, Mar 19, 2007 at 06:16:57PM -0400, Luis D. García wrote: > Hello, I'm writinng again because I need to make some validation for > the incoming data (VALUES... on the INSERT-Stmt). This validation > is based on adding a TIMESTAMP and a TIME kind of data. > > >From the Shell I can make: > > template1=# select timestamp '02/03/85 7:00pm'+'00:00:02.3450' as > "TIMESTAMP+TIME"; You're confused. You're not adding TIME, you're adding an INTERVAL, which is something quite different. > That's exactly wath I need to do, obtain the result from adding a TIMESTAMP > and a TIME, but I must do it from the Postgre's source code, since I'm > working > on modifying Postgres for a University Project (here in Venezuela we call it > "Tesis" or "Graduation Special Work". Well, any function you can call from SQL you can call from C, see the OidFunctionCall functions. > PD: in adition, both data (TIMESTAMP and TIME) are stored in strings (char > *). Err, why, when there are perfectly good datatypes to store that type of data. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to litigate.