8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.111 2000/04/04 01 :21:48 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.112 2000/04/08 00 :21:15 tgl Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -1369,8 +1369,9 @@ _copyStream(Stream *from)
1369
1369
return newnode ;
1370
1370
}
1371
1371
1372
- /*
1373
- * parsenodes.h routines have no copy functions
1372
+ /* ****************************************************************
1373
+ * parsenodes.h copy functions
1374
+ * ****************************************************************
1374
1375
*/
1375
1376
1376
1377
static TargetEntry *
@@ -1467,14 +1468,7 @@ _copyQuery(Query *from)
1467
1468
Query * newnode = makeNode (Query );
1468
1469
1469
1470
newnode -> commandType = from -> commandType ;
1470
- if (from -> utilityStmt && nodeTag (from -> utilityStmt ) == T_NotifyStmt )
1471
- {
1472
- NotifyStmt * from_notify = (NotifyStmt * ) from -> utilityStmt ;
1473
- NotifyStmt * n = makeNode (NotifyStmt );
1474
-
1475
- n -> relname = pstrdup (from_notify -> relname );
1476
- newnode -> utilityStmt = (Node * ) n ;
1477
- }
1471
+ Node_Copy (from , newnode , utilityStmt );
1478
1472
newnode -> resultRelation = from -> resultRelation ;
1479
1473
if (from -> into )
1480
1474
newnode -> into = pstrdup (from -> into );
@@ -1510,10 +1504,117 @@ _copyQuery(Query *from)
1510
1504
return newnode ;
1511
1505
}
1512
1506
1507
+ static ClosePortalStmt *
1508
+ _copyClosePortalStmt (ClosePortalStmt * from )
1509
+ {
1510
+ ClosePortalStmt * newnode = makeNode (ClosePortalStmt );
1511
+
1512
+ if (from -> portalname )
1513
+ newnode -> portalname = pstrdup (from -> portalname );
1514
+
1515
+ return newnode ;
1516
+ }
1517
+
1518
+ static TruncateStmt *
1519
+ _copyTruncateStmt (TruncateStmt * from )
1520
+ {
1521
+ TruncateStmt * newnode = makeNode (TruncateStmt );
1522
+
1523
+ newnode -> relName = pstrdup (from -> relName );
1524
+
1525
+ return newnode ;
1526
+ }
1527
+
1528
+ static NotifyStmt *
1529
+ _copyNotifyStmt (NotifyStmt * from )
1530
+ {
1531
+ NotifyStmt * newnode = makeNode (NotifyStmt );
1532
+
1533
+ if (from -> relname )
1534
+ newnode -> relname = pstrdup (from -> relname );
1535
+
1536
+ return newnode ;
1537
+ }
1538
+
1539
+ static ListenStmt *
1540
+ _copyListenStmt (ListenStmt * from )
1541
+ {
1542
+ ListenStmt * newnode = makeNode (ListenStmt );
1543
+
1544
+ if (from -> relname )
1545
+ newnode -> relname = pstrdup (from -> relname );
1546
+
1547
+ return newnode ;
1548
+ }
1549
+
1550
+ static UnlistenStmt *
1551
+ _copyUnlistenStmt (UnlistenStmt * from )
1552
+ {
1553
+ UnlistenStmt * newnode = makeNode (UnlistenStmt );
1554
+
1555
+ if (from -> relname )
1556
+ newnode -> relname = pstrdup (from -> relname );
1557
+
1558
+ return newnode ;
1559
+ }
1560
+
1561
+ static TransactionStmt *
1562
+ _copyTransactionStmt (TransactionStmt * from )
1563
+ {
1564
+ TransactionStmt * newnode = makeNode (TransactionStmt );
1565
+
1566
+ newnode -> command = from -> command ;
1567
+
1568
+ return newnode ;
1569
+ }
1570
+
1571
+ static LoadStmt *
1572
+ _copyLoadStmt (LoadStmt * from )
1573
+ {
1574
+ LoadStmt * newnode = makeNode (LoadStmt );
1575
+
1576
+ if (from -> filename )
1577
+ newnode -> filename = pstrdup (from -> filename );
1578
+
1579
+ return newnode ;
1580
+ }
1581
+
1582
+ static VariableSetStmt *
1583
+ _copyVariableSetStmt (VariableSetStmt * from )
1584
+ {
1585
+ VariableSetStmt * newnode = makeNode (VariableSetStmt );
1586
+
1587
+ if (from -> name )
1588
+ newnode -> name = pstrdup (from -> name );
1589
+ if (from -> value )
1590
+ newnode -> value = pstrdup (from -> value );
1591
+
1592
+ return newnode ;
1593
+ }
1594
+
1595
+ static VariableResetStmt *
1596
+ _copyVariableResetStmt (VariableResetStmt * from )
1597
+ {
1598
+ VariableResetStmt * newnode = makeNode (VariableResetStmt );
1599
+
1600
+ if (from -> name )
1601
+ newnode -> name = pstrdup (from -> name );
1602
+
1603
+ return newnode ;
1604
+ }
1605
+
1606
+ static LockStmt *
1607
+ _copyLockStmt (LockStmt * from )
1608
+ {
1609
+ LockStmt * newnode = makeNode (LockStmt );
1610
+
1611
+ if (from -> relname )
1612
+ newnode -> relname = pstrdup (from -> relname );
1613
+ newnode -> mode = from -> mode ;
1614
+
1615
+ return newnode ;
1616
+ }
1513
1617
1514
- /*
1515
- * mnodes.h routines have no copy functions
1516
- */
1517
1618
1518
1619
/* ****************************************************************
1519
1620
* pg_list.h copy functions
@@ -1718,9 +1819,6 @@ copyObject(void *from)
1718
1819
/*
1719
1820
* PARSE NODES
1720
1821
*/
1721
- case T_Query :
1722
- retval = _copyQuery (from );
1723
- break ;
1724
1822
case T_TargetEntry :
1725
1823
retval = _copyTargetEntry (from );
1726
1824
break ;
@@ -1742,6 +1840,39 @@ copyObject(void *from)
1742
1840
case T_TypeCast :
1743
1841
retval = _copyTypeCast (from );
1744
1842
break ;
1843
+ case T_Query :
1844
+ retval = _copyQuery (from );
1845
+ break ;
1846
+ case T_ClosePortalStmt :
1847
+ retval = _copyClosePortalStmt (from );
1848
+ break ;
1849
+ case T_TruncateStmt :
1850
+ retval = _copyTruncateStmt (from );
1851
+ break ;
1852
+ case T_NotifyStmt :
1853
+ retval = _copyNotifyStmt (from );
1854
+ break ;
1855
+ case T_ListenStmt :
1856
+ retval = _copyListenStmt (from );
1857
+ break ;
1858
+ case T_UnlistenStmt :
1859
+ retval = _copyUnlistenStmt (from );
1860
+ break ;
1861
+ case T_TransactionStmt :
1862
+ retval = _copyTransactionStmt (from );
1863
+ break ;
1864
+ case T_LoadStmt :
1865
+ retval = _copyLoadStmt (from );
1866
+ break ;
1867
+ case T_VariableSetStmt :
1868
+ retval = _copyVariableSetStmt (from );
1869
+ break ;
1870
+ case T_VariableResetStmt :
1871
+ retval = _copyVariableResetStmt (from );
1872
+ break ;
1873
+ case T_LockStmt :
1874
+ retval = _copyLockStmt (from );
1875
+ break ;
1745
1876
1746
1877
/*
1747
1878
* VALUE NODES
0 commit comments