Unix Technical Forum

Re: executing a procedure withing a procedure?

This is a discussion on Re: executing a procedure withing a procedure? within the pgsql Novice forums, part of the PostgreSQL category; --> > What do I add on the front end in order to bid the form to a view when ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 11:06 PM
Richard Broersma Jr
 
Posts: n/a
Default Re: executing a procedure withing a procedure?

> What do I add on the front end in order to bid the form to a view when
> updating data?


Don't forget to copy the list when you have a question so that other can reply also.

I am not sure I understand your first question. But if you want to bind a view to a form in
ms-access, look at:
http://www.postgresql.org/download/
under application interfaces -- odbc


> Also, the procedure I need to write are for a report in access. How would I
> link the procedure to the report? I do have several parameters for the
> procedure, so any advice is welcome.


hmm.. I never tried binding a report to a pl-pgsql function before. I imagine that you could do
it through a pass-through query where you:
select * from <your_function>;

Alternitivly, you could create a view in postgresql that is a "select * from <your_function>" and
then bind your report to that view.

Regards,

Richard Broersma Jr.


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 11:06 PM
Mike Ellsworth
 
Posts: n/a
Default Alter column

Good Monday,

Is there a way to convert data type `datetime` into an integer
(unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
USING CAST(`column_name` as integer) ...... something like this?

Thanks,
Mike E.


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 11:06 PM
Christoph Frick
 
Posts: n/a
Default Re: Alter column

On Mon, Aug 14, 2006 at 08:00:59AM -0400, Mike Ellsworth wrote:

hi,

> Is there a way to convert data type `datetime` into an integer
> (unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
> USING CAST(`column_name` as integer) ...... something like this?


i dont know, if it solves your problem - for reading i usually cast like
this:

EXTRACT(EPOCH FROM ts) as ts

and for writing:

ts::int4::abstime::timestamp

--
cu

-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAkTgZ0kACgkQOO9i6TSuoN2afgCbBYTt3rCKSJ lnDw33ynR6FjCY
UOoAn2JZqQXSW+jc/F7mIOAg3tbI9PzR
=Teu3
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-17-2008, 11:06 PM
Michael Fuhr
 
Posts: n/a
Default Re: Alter column

On Mon, Aug 14, 2006 at 08:00:59AM -0400, Mike Ellsworth wrote:
> Is there a way to convert data type `datetime` into an integer


There is no datetime type. Do you mean timestamp or timestamp with
time zone?

> (unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
> USING CAST(`column_name` as integer) ...... something like this?


Is this what you're looking for?

ALTER TABLE foo ALTER COLUMN column_name TYPE integer
USING extract(epoch FROM column_name);

--
Michael Fuhr

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-17-2008, 11:06 PM
Tom Lane
 
Posts: n/a
Default Re: Alter column

Mike Ellsworth <nhrcommu@rochester.rr.com> writes:
> Is there a way to convert data type `datetime` into an integer
> (unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
> USING CAST(`column_name` as integer) ...... something like this?


Something involving extract(epoch) would do that ... but why do you
want to? If the column is really timestamps then you are almost always
best off to declare it as timestamps. When you have a client that wants
a numeric version, they can do the extract(epoch) bit when they select
the data (or you can make a view that does so, if the client code is
too brain-dead to manage it for itself). The normal rule of good
database design is that the database should have as much knowledge
as possible about what it's storing, not as little as possible.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-17-2008, 11:06 PM
Mike Ellsworth
 
Posts: n/a
Default Re: Alter column

Tom Lane wrote:

>Mike Ellsworth <nhrcommu@rochester.rr.com> writes:
>
>
>>Is there a way to convert data type `datetime` into an integer
>>(unix_timestamp) while doing ALTER COLUMN `column_name` TYPE int4
>>USING CAST(`column_name` as integer) ...... something like this?
>>
>>

>
>Something involving extract(epoch) would do that ... but why do you
>want to? If the column is really timestamps then you are almost always
>best off to declare it as timestamps. When you have a client that wants
>a numeric version, they can do the extract(epoch) bit when they select
>the data (or you can make a view that does so, if the client code is
>too brain-dead to manage it for itself). The normal rule of good
>database design is that the database should have as much knowledge
>as possible about what it's storing, not as little as possible.
>
> regards, tom lane
>

Actually, we do not have a specific purpose in mind. We're trying to
make a simple GUI that will allow users to do this if they (for whatever
the reason) feel the need.

Your point is a good one though and we should probably include a
Javascript warning for this particular 'feature'.

Thanks,
Mike

>
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 02:49 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com