[SQL] how to show table structure?
Greetings, How can I see the layout of a table in PostgreSQL 7.4? I've checked several books and on-line documents, but was not able to figure out how PostgreSQL does 'describe ' like it's done in other databases. Thanks in advance for any help. Bing ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
[SQL] can insert 'null' into timestamp type field from command line but not from input file?
The table is like this: maxware=# \d test; Table "public.test" Column |Type | Modifiers +-+--- a | timestamp without time zone | b | integer | = The following insert command works fine: maxware=# insert into test (a,b) values (null,'1'); But importing from an input data file does not seem to work as shown below: = maxware=# copy tbl_spcase from '/home/bdu/test/input.data' delimiter as '|'; ERROR: invalid input syntax for integer: "null" CONTEXT: COPY tbl_spcase, line 1, column col_id_spcase: "null" == The input.data file just has one line. But no matter what I did, neither of the following input format worked. 1. null|1 2. |1 3. ''|1 How should I represent blank value for the field that's of timestamp type? Thanks in advance for any help, Bing ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [SQL] can insert 'null' into timestamp type field from command
I've figured it out, that is using 'null as ' with the COPY command. Bing > The table is like this: > > > maxware=# \d test; >Table "public.test" > Column |Type | Modifiers > +-+--- > a | timestamp without time zone | > b | integer | > = > > The following insert command works fine: > > maxware=# insert into test (a,b) values (null,'1'); > > But importing from an input data file does not seem to work as shown > below: > > = > maxware=# copy tbl_spcase from '/home/bdu/test/input.data' delimiter as > '|'; > ERROR: invalid input syntax for integer: "null" > CONTEXT: COPY tbl_spcase, line 1, column col_id_spcase: "null" > == > > The input.data file just has one line. But no matter what I did, neither > of the following input format worked. > > 1. null|1 > 2. |1 > 3. ''|1 > > How should I represent blank value for the field that's of timestamp type? > > Thanks in advance for any help, > > Bing > > ---(end of broadcast)--- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED]) > ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
