Can I get Field informations from system tables?

Поиск
Список
Период
Сортировка
От Durumdara
Тема Can I get Field informations from system tables?
Дата
Msg-id 9e384ef60908130820r26b00d91ua235794bcb04b1f7@mail.gmail.com
обсуждение исходный текст
Ответы Re: Can I get Field informations from system tables?
Список pgsql-general
Hi!

I must get informations about the tables.
For example:
Tnnn:
1. [Field Name, Type, Size, NotNull]
2. [Field Name, Type, Size, NotNull]
...

The test table is this:

CREATE TABLE testfields
(
  fbigint bigint NOT NULL,
  fbool boolean,
  fchar character(100),
  fcharv character varying(100),
  fdate date,
  fdouble double precision,
  fint integer,
  fnum numeric,
  fmemo text,
  ftimez time with time zone,
  ftime time without time zone,
  ftimestampz timestamp with time zone,
  ftimestamp timestamp without time zone,
  fserial serial NOT NULL,
  CONSTRAINT testfields_pkey PRIMARY KEY (fserial)
)

When I see Pygresql, I got only these informations:

Command line: C:\Python25\python.exe c:\PGDB_T~1.PY
Working directory: c:\
Timeout: 0 ms

[{'FSERIAL': 1, 'FMEMO': 'fdsf sdf dsfds sdd sfsdfsdfsd dsfsd sdfsd ssdsd sdsd', 'FCHAR': 'alma                                                                                                ', 'FBIGINT': 1L, 'FNUM': Decimal("454.3234"), 'FTIMESTAMPZ': '1999-01-01 10:10:10+01', 'FINT': 43545, 'FTIMEZ': '10:10:10+02', 'FDOUBLE': 4.5656656, 'FTIME': '10:10:10', 'FCHARV': 'alma', 'FDATE': '1999-03-25', 'FTIMESTAMP': '1999-01-01 10:10:10', 'FBOOL': True}]

('fbigint', 'int8', None, 8, None, None, None)
('fbool', 'bool', None, 1, None, None, None)
('fchar', 'bpchar', None, -1, None, None, None)
('fcharv', 'varchar', None, -1, None, None, None)
('fdate', 'date', None, 4, None, None, None)
('fdouble', 'float8', None, 8, None, None, None)
('fint', 'int4', None, 4, None, None, None)
('fnum', 'numeric', None, -1, None, None, None)
('fmemo', 'text', None, -1, None, None, None)
('ftimez', 'timetz', None, 12, None, None, None)
('ftime', 'time', None, 8, None, None, None)
('ftimestampz', 'timestamptz', None, 8, None, None, None)
('ftimestamp', 'timestamp', None, 8, None, None, None)
('fserial', 'int4', None, 4, None, None, None)

Process "Python Interpeter" terminated, ExitCode: 00000000

The main problem that I don't see the size of the char/varchar fields, and I don't determine that int field is serial or not?

Thanks for the help:
   dd

В списке pgsql-general по дате отправления:

Предыдущее
От: "Dan Halbert"
Дата:
Сообщение: array syntax and geometric type syntax
Следующее
От: Sam Mason
Дата:
Сообщение: Re: comparing NEW and OLD (any good this way?)