Dooling Posted July 13, 2006 Report Share Posted July 13, 2006 Ir izveidota tabula: CREATE SEQUENCE "sesija_ID_seq" INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1; ALTER TABLE "sesija_ID_seq" OWNER TO root; CREATE TABLE sesija ( "ID" int4 NOT NULL DEFAULT nextval('"sesija_ID_seq"'::regclass), lietotajs varchar(30) NOT NULL DEFAULT '0'::character varying, sesijas varchar(64) NOT NULL DEFAULT '0'::character varying, "time" varchar(20) NOT NULL DEFAULT '0'::character varying, CONSTRAINT sesija_pkey PRIMARY KEY ("ID") ) WITH OIDS; Lieta tāda, kad veicu selektu "SELECT ID FROM sesija ORDER BY ID DESC" prādās šāda kļūda: Warning: pg_query(): Query failed: ERROR: column "id" does not exist Link to comment Share on other sites More sharing options...
bubu Posted July 13, 2006 Report Share Posted July 13, 2006 Iespējams, ka ID ir rezervētais vārds. Pamēģini SELECT "ID" ... Tieši tāpat kā CREATE teikumā. Iesaku vispār nelietot rezervētos vārdus, bet piemēram sesija_id. Link to comment Share on other sites More sharing options...
Dooling Posted July 13, 2006 Author Report Share Posted July 13, 2006 (edited) Yap, PostgreSQL izskatās nepatīk, ka izmanto rezervētos vārdus. Edited July 13, 2006 by Dooling Link to comment Share on other sites More sharing options...
Delfins Posted July 13, 2006 Report Share Posted July 13, 2006 un nepatīk arī, ja izmanto uppercase vai dažādu case fieldu/indeksu/tabulu nosaukumus... būs jālieto visur pēdiņas un jāčakarējās.. Principā postgresā visu raksta lowercase... Link to comment Share on other sites More sharing options...
Recommended Posts