Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ SQL » PostgreSQL issues
Re: PostgreSQL issues [message #9656 is a reply to message #9654] Wed, 23 May 2007 22:47 Go to previous messageGo to previous message
zsolt is currently offline  zsolt
Messages: 702
Registered: December 2005
Location: Budapest, Hungary
Contributor
BTW in my dev environment, I use SERIAL differently, because I wanted a common .sch file for my SQLite and PostgreSQL databases with the same behaviour.
So I use these lines for SQLite:
#define SERIAL(x)                  COLUMN("integer primary key autoincrement", int64, x, 0, 0) //int is not enough, as it is unsigned
#define SERIAL_ARRAY(x, items)     COLUMN_ARRAY("integer primary key autoincrement", int64, x, 0, 0, items)
#define SERIAL_(x)                 COLUMN_("integer primary key autoincrement", int64, x, 0, 0)
#define SERIAL_ARRAY_(x, items)    COLUMN_ARRAY_("integer primary key autoincrement", int64, x, 0, 0, items)

#define BIGSERIAL(x)               COLUMN("integer primary key autoincrement", int64, x, 0, 0)
#define BIGSERIAL_ARRAY(x, items)  COLUMN_ARRAY("integer primary key autoincrement", int64, x, 0, 0, items)
#define BIGSERIAL_(x)              COLUMN_("integer primary key autoincrement", int64, x, 0, 0)
#define BIGSERIAL_ARRAY_(x, items) COLUMN_ARRAY_("integer primary key autoincrement", int64, x, 0, 0, items)


and these lines for PostgreSQL:
#define SERIAL(x)                  COLUMN("serial primary key", int64, x, 0, 0) //int is not enough, as it is unsigned
#define SERIAL_ARRAY(x, items)     COLUMN_ARRAY("serial primary key", int64, x, 0, 0, items)
#define SERIAL_(x)                 COLUMN_("serial primary key", int64, x, 0, 0)
#define SERIAL_ARRAY_(x, items)    COLUMN_ARRAY_("serial primary key", int64, x, 0, 0, items)

#define BIGSERIAL(x)               COLUMN("bigserial primary key", int64, x, 0, 0)
#define BIGSERIAL_ARRAY(x, items)  COLUMN_ARRAY("bigserial primary key", int64, x, 0, 0, items)
#define BIGSERIAL_(x)              COLUMN_("bigserial primary key", int64, x, 0, 0)
#define BIGSERIAL_ARRAY_(x, items) COLUMN_ARRAY_("bigserial primary key", int64, x, 0, 0, items)


So SERIAL in my terminology means a field type as it is incrementing automatically, serves as a primary key, and records can never have the same (old) id after deleting rows.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to access a firebird database ?
Next Topic: Returning a null from select
Goto Forum:
  


Current Time: Tue Jul 08 19:37:54 CEST 2025

Total time taken to generate the page: 0.03282 seconds