pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedUser defined table is not present in postgresql.
4+ messages / 4 participants
[nested] [flat]
* User defined table is not present in postgresql.
@ 2017-03-28 09:35 MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>
0 siblings, 2 replies; 4+ messages in thread
From: MAJUMDER, SAYAN @ 2017-03-28 09:35 UTC (permalink / raw)
To: pgsql-admin
Hi,
I am new to postgres and presently migrating from sql server to postgres and facing some problems. Kindly help me with this.
We have user defined table in sql server, I am unable to find the same in postgres. Postgres have the concept of Types but
The problem is I cannot set the default value of a column in Types available in postgres. I will be highly obliged if you solve me through
This.
Thanks and regards,
Sayan Majumder.
This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: User defined table is not present in postgresql.
@ 2017-03-28 15:44 David G. Johnston <david.g.johnston@gmail.com>
parent: MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>
1 sibling, 0 replies; 4+ messages in thread
From: David G. Johnston @ 2017-03-28 15:44 UTC (permalink / raw)
To: MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>; +Cc: pgsql-admin
On Tue, Mar 28, 2017 at 2:35 AM, MAJUMDER, SAYAN <
sayan.a.majumder@capgemini.com> wrote:
> Hi,
>
> I am new to postgres and presently migrating from sql server to postgres
> and facing some problems. Kindly help me with this.
>
> We have user defined table in sql server, I am unable to find the same in
> postgres. Postgres have the concept of Types but
>
> The problem is I cannot set the default value of a column in Types
> available in postgres. I will be highly obliged if you solve me through
>
> This.
>
Um...
CREATE TABLE ... ?
https://www.postgresql.org/docs/current/static/sql-createtable.html
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: User defined table is not present in postgresql.
@ 2017-03-28 16:19 Scott Marlowe <scott.marlowe@gmail.com>
parent: MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>
1 sibling, 1 reply; 4+ messages in thread
From: Scott Marlowe @ 2017-03-28 16:19 UTC (permalink / raw)
To: MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>; +Cc: pgsql-admin
On Tue, Mar 28, 2017 at 3:35 AM, MAJUMDER, SAYAN
<sayan.a.majumder@capgemini.com> wrote:
> Hi,
>
> I am new to postgres and presently migrating from sql server to postgres and
> facing some problems. Kindly help me with this.
>
> We have user defined table in sql server, I am unable to find the same in
> postgres. Postgres have the concept of Types but
>
> The problem is I cannot set the default value of a column in Types available
> in postgres. I will be highly obliged if you solve me through
>
> This.
OK You can define custom types with create type.
You can set a default when you create a table.
Types, by definition, do not include a default value though.
postgres=# create type mytype as (a int, b text);
CREATE TYPE
postgres=# create table mytable (a mytype default (0,'abc'));
CREATE TABLE
postgres=# insert into mytable (a) values (default);
INSERT 0 1
postgres=# select * from mytable;
a
---------
(0,abc)
How's that?
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: User defined table is not present in postgresql.
@ 2017-03-28 16:27 Tom Lane <tgl@sss.pgh.pa.us>
parent: Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2017-03-28 16:27 UTC (permalink / raw)
To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>; pgsql-admin
Scott Marlowe <scott.marlowe@gmail.com> writes:
> You can set a default when you create a table.
> Types, by definition, do not include a default value though.
Domains can specify defaults ... although I don't think we allow domains
over composite types, which perhaps is what the OP would need. His
requirements are so vaguely stated that it's hard to be sure.
regards, tom lane
--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2017-03-28 16:27 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 09:35 User defined table is not present in postgresql. MAJUMDER, SAYAN <sayan.a.majumder@capgemini.com>
2017-03-28 15:44 ` David G. Johnston <david.g.johnston@gmail.com>
2017-03-28 16:19 ` Scott Marlowe <scott.marlowe@gmail.com>
2017-03-28 16:27 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox