Обсуждение: OT : timestamps and jbuilder (help, please)

Поиск
Список
Период
Сортировка

OT : timestamps and jbuilder (help, please)

От
miguel angel rojas aquino
Дата:
hi everybody, hope any one can give me some insigth about this one, we
are in great despair  :(

we are developing an application using jbuilder 5 and postgresql
7.2.2-1PGDG, and found some strange beheavior with the timestamps, say
for example, in our database we have a record like this one:

          id_emp | name              |      date
--------+--------+------------------------
              1004 |  laura              | 2002-09-19 00:00:00-05

but when displaying this same date in a textfield in our application, it
says the date is 2002-09-18 23:00:00!!!!

the date field is a timestamp with time zone, we tried using a timestamp
without time zone, but our app starts complaining when trying to save
changes to the database about not finding the original row

it gets worst as we need the right date to make some calculations about
the number of days between dates.

when querying this same database using SquirrelSQL (a java database
client), the date apperas correctly as is in the database, so i think
the problem is with the borland dataexpress components, but i'm not
sure, so if somebody got the same problems, it would be greatly
appreciated if can share the solution

many thanks in advance, and best regards


Couple quick questions....

От
Dan Ostrowski
Дата:
Hullo all.

Developing with PostgreSQL for the first time, and just had a few quick
questions:

1)  How are indexes recorded? Is there a system table that stores
sequences/indexes, or are they stored internally?  I would like to be
able to access ALL sequences/indexes in a database just by name, so i
can have a program do maintenance ( i.e. delete them when needed ).

2) I need functionality akin to a "DESC table"  where i can get a query
result ( from an API, not the command line program ) that describes
type, name, etc. about the fields in a table.  I know this one has been
answered here, but i seem to have lost the message i saved about it.

Thanks very much,
dan



Re: Couple quick questions....

От
Ian Barwick
Дата:
On Sunday 03 November 2002 18:47, Dan Ostrowski wrote:
> Hullo all.
>
> Developing with PostgreSQL for the first time, and just had a few quick
> questions:
>
> 1)  How are indexes recorded? Is there a system table that stores
> sequences/indexes, or are they stored internally?  I would like to be
> able to access ALL sequences/indexes in a database just by name, so i
> can have a program do maintenance ( i.e. delete them when needed ).
>
> 2) I need functionality akin to a "DESC table"  where i can get a query
> result ( from an API, not the command line program ) that describes
> type, name, etc. about the fields in a table.  I know this one has been
> answered here, but i seem to have lost the message i saved about it.

The short answer:
have a look at the pg_* tables (in psql type \dS )

The "RTFM" answer:
http://www.postgresql.org/idocs/index.php?extend.html

The practical answer:
Start psql with the -E option; this will show you the SQL statements
used when executing various slash commands.

HTH

Ian Barwick
barwick@gmx.net


Re: Couple quick questions....

От
Tom Lane
Дата:
Ian Barwick <barwick@gmx.net> writes:
> The "RTFM" answer:
> http://www.postgresql.org/idocs/index.php?extend.html

Also see
http://developer.postgresql.org/docs/postgres/catalogs.html
for the lowdown on all the system catalogs.  (As of 7.3, this
is actually pretty complete...)

            regards, tom lane

Re: OT : timestamps and jbuilder (help, please)

От
Richard Huxton
Дата:
On Saturday 02 Nov 2002 10:25 pm, miguel angel rojas aquino wrote:
> hi everybody, hope any one can give me some insigth about this one, we
> are in great despair  :(
>
> we are developing an application using jbuilder 5 and postgresql
> 7.2.2-1PGDG, and found some strange beheavior with the timestamps, say
> for example, in our database we have a record like this one:
>
>           id_emp | name              |      date
> --------+--------+------------------------
>               1004 |  laura              | 2002-09-19 00:00:00-05
>
> but when displaying this same date in a textfield in our application, it
> says the date is 2002-09-18 23:00:00!!!!

Are you absolutely certain that psql and your java application have the same
timezone in their environment? What happens with a select now()?

--
  Richard Huxton