Skip site navigation (1) Skip section navigation (2)

Re: Function or Field?

From: "Joel Fradkin" <jfradkin(at)wazagua(dot)com>
To: <lucas(at)presserv(dot)org>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Function or Field?
Date: 2005-05-02 21:10:45
Message-ID: 001101c54f5b$685275e0$797ba8c0@jfradkin (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
You could also make a table with just that data in it so you don't have the
field in all the records and you don't have to check all the records to see
what is next.

I am assuming this is some kind of a flag values used in a batch, if you
just need the last id I use max(id)+1.

Joel Fradkin
Wazagua, Inc.
2520 Trailmate Dr
Sarasota, Florida 34243
Tel.  941-753-7111 ext 305
Powered by Wazagua
Providing you with the latest Web-based technology & advanced tools.
C 2004. WAZAGUA, Inc. All rights reserved. WAZAGUA, Inc
 This email message is for the use of the intended recipient(s) and may
contain confidential and privileged information.  Any unauthorized review,
use, disclosure or distribution is prohibited.  If you are not the intended
recipient, please contact the sender by reply email and delete and destroy
all copies of the original message, including attachments.


-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org]
On Behalf Of lucas(at)presserv(dot)org
Sent: Monday, May 02, 2005 3:17 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] Function or Field?

What is the better way to store the last record for a translation???
 The data for the last product vendding.
 What is better:
 a) Create a field in "product" table and create a Trigger (before insert or
update into vendding table) to alter this field.
 b) Create a view or function that check the all venddings (in vendding
for the specified product and return the last vendding information?

 CREATE TABLE products(
  id serial primary key,
  description varchar(50),
  last_vendding date()        --Is correct to use this field???
 CREATE TABLE vendding(
  id serial primary key,
  date_ date,
  product integer references (products)
 CREATE TRIGGER TG_change_products_last_vendding_field on table vendding

  CREATE TABLE products (
   id serial primary key,
   description varchar(50)
  CREATE TABLE vendding(
   id serial primary key,
   date_ date,
   product integer references (products)
  CREATE VIEW last_product_change as SELECT * from vendding order by date_
limit 1; --Okay, this view will return the last record and not the last
for a product... but its a example.

I am asking it becouse I have used CLIPPER(dbase) for my old programs and in
DBASE the view/check function that will check for each select is not
functional. And I need to create a field in all table references, but in
this fields allways broken and I need to recheck it.

Thank you.

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

In response to


pgsql-sql by date

Next:From: Markus SchaberDate: 2005-05-02 22:09:56
Subject: Re: [ANNOUNCE] pgtop, display PostgreSQL processes in `top' style
Previous:From: lucasDate: 2005-05-02 20:16:44
Subject: Function or Field?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group