Elian Laura wrote:
> Hello,
> I´m an undergraduate in Peru in systems engineering.
> I need to know about how does postgres work with the definition of
> data type in run time.
> I downloaded de source code of postgres, but es very complex, at least
> I would like to know in which part of the code is the recognition of a
> data that the user enters. I write a data in a field and the postgress
> must know what kind it is, as it do that?
postgres is, at the core, a relational database engine with a SQL
language processor, it doesn't know what a 'field' is.
the fundamental storage units of a relational database are tables made
of rows made of columns. a column of a row of a given table is akin to
a field, but on disk these are stored in a binary representation, the
typing information required to decode it is part of the table definition.
the only user 'input' is SQL statements, such as...
CREATE TABLE users (uid INTEGER, username TEXT, firstname TEXT,
lastname TEXT);
INSERT INTO users (uid, username) VALUES (103, 'jpierce', 'John',
'Pierce'), ('104', 'elaura', 'Elian', 'Laura');
SELECT username,firstname,lastname FROM users WHERE uid=103;
(I use all upper case letters for SQL keywords to distinguish them, in
fact, SQL doesn't care)
Things like forms, fields, human input decoding are the domain of the
user application software, which will generate and execute SQL
statements to store the data in the database.
Is this clear enough?