🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.os.linux.programowanie
Article #392

Postgres SQL - default

#392
From: isthar
Date: Tue, 14 Sep 1999 05:45
29 lines
1364 bytes
Czesc.

Sprawa dotyczy sql-a w jego postgresowej wersji.
po zdefiniowaniu kolumny w tabeli jako typ serial

create table x (
    id serial,
    test char(4)
)

powinienem otrzymac kolumne id z automatycznym numerowaniem.
nie wiem tylko jak podczas insertu zamarkowac to pole
by nie bylo bledu skladni a jednoczesnie numerowanie dzialalo by.

w mysql-u robie tak

function test($zmienna){
    $query="insert into x values(0, $zmienna)";

    ...

    return;
}

w miejsce kolumny z typem auto_increment daje 0 i dziala
czy ktos wie jak to przedstawic dla postgresa ?


pozdrawiam ...
Technical Details
Message-ID: <37DDE115.98949EBD@sote.poznan.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!uw.edu.pl!news.icm.edu.pl!news.ipartners.pl!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!mat.uni.torun.pl!uw.edu.pl!news.icm.edu.pl!news.ipartners.pl!not-for-mail
From: isthar <isthar@sote.poznan.pl>
Newsgroups: pl.comp.os.linux.programowanie
Subject: Postgres SQL - default
Date: Tue, 14 Sep 1999 07:45:59 +0200
Organization: Internet Partners
Lines: 30
Message-ID: <37DDE115.98949EBD@sote.poznan.pl>
NNTP-Posting-Host: dlp-poznan-as1-as43.ipartners.pl
Mime-Version: 1.0
X-Trace: news.ipartners.pl 937288135 59262 157.25.160.172 (14 Sep 1999 05:48:55 GMT)
X-Complaints-To: abuse@ipartners.pl
NNTP-Posting-Date: 14 Sep 1999 05:48:55 GMT
X-Mailer: Mozilla 4.6 (Macintosh; I; PPC)
X-Accept-Language: en
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit