Hi Bill, Here are the details of the table and the query i want to insert.
aml_db=> \d+ check_date Table "public.check_date" Column | Type | Modifiers | Storage | Stats target | Description -----------+-----------------------------+-----------+---------+--------------+------------- some_date | date | | plain | | sno | integer | | plain | | new_date | timestamp without time zone | | plain | | Has OIDs: no aml_db=> select * from check_date; some_date | sno | new_date -----------+-----+---------- (0 rows) aml_db=> insert into check_date values (to_date('','yyyymmddhh24miss'),1,to_date('','yyyymmddhh24miss')); INSERT 0 1 aml_db=> select * from check_date; some_date | sno | new_date ---------------+-----+------------------------ 01/01/0001 BC | 1 | 01/01/0001 00:00:00 BC (1 row) I need to enter NULL as my date. but since I am getting these variables into the bind variables as empty string that is this issue is happening. Thanks & Regards Medhavi Mahansaria Tata Consultancy Services Limited Unit-VI, No.78, 79& 83, L-Centre, EPIP Industrial Estate, Whitefield Bangalore - 560066,Karnataka India Ph:- +91 80 67253769 Cell:- +91 9620053040 Mailto: medhavi.mahansa...@tcs.com Website: http://www.tcs.com ____________________________________________ Experience certainty. IT Services Business Solutions Consulting ____________________________________________ From: Bill Moran <wmo...@potentialtech.com> To: Medhavi Mahansaria <medhavi.mahansa...@tcs.com> Cc: pgsql-general@postgresql.org Date: 03/06/2015 02:56 PM Subject: Re: [GENERAL] #PERSONAL# Reg: date going as 01/01/0001 On Fri, 6 Mar 2015 10:04:38 +0530 Medhavi Mahansaria <medhavi.mahansa...@tcs.com> wrote: > > I need to enter the date in null column based on the results obtained. > > but my date gets inserted as 01/01/0001 in postgresql 9.3 when there is no > value. > I need to enter NULL in the column. This isn't how PostgreSQL behaves. Something else is causing this behavior ... either the client library or triggers or something else configured on the table. More detail would help us help you. Provide the CREATE TABLE statement that created the table, as well as details of what software you're using to execute the query, and the query itself. -- Bill Moran =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you