Created
January 17, 2015 18:15
-
-
Save dizballanze/af1caf10c3b6fae19147 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TYPE address AS (country text, city text, zip varchar(6), street text, number text, building text); | |
CREATE TABLE users (id SERIAL PRIMARY KEY, email text, adresses address[]); | |
INSERT INTO users(email, adresses) VALUES('user1@example.org', ARRAY[ROW('RU', 'Moscow', '123123', 'Lenina', '5', 'a')::address, ROW('RU', 'SPB', '123456', 'Gagarina', '102', '5')::address]); | |
SELECT * FROM users; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id | email | adresses | |
----+-------------------+-------------------------------------------------------------------- | |
1 | user1@example.org | {"(RU,Moscow,123123,Lenina,5,a)","(RU,SPB,123456,Gagarina,102,5)"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment